Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Random numbers in functions



On Tue, 20 Nov 2007 14:30:39 -0500 (EST)
Justin M Wozniak <jwozniak@xxxxxxxxxx> wrote:
> Thanks!  But since I'm planning to obtain many random numbers I'd like to 
> do this without file operations.  Using a global variable should be 
> equivalent to your solution but the output of rand48() seems to be 
> convergent.

I thought your problem was that you were running stuff in different
shells or subshells or something.  However, as you're not, it seems
likely you're running across a bug:

2004-06-08  Peter Stephenson  <pws@xxxxxxxxxxxxxxxxxxxxxxxx>

	* 20029: Src/Modules/mathfunc.c: rand48(seed) stopped being
	random after the second call.

That was fixed a while ago, however; it should even be in the current 4.2.x
version.

-- 
Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/



Messages sorted by: Reverse Date, Date, Thread, Author