On Mon, Dec 04, 2000 at 09:23:48AM +1100, Peter Jeremy wrote:
> >Hi. I've switched to the new random.c you sent me for gawk. My
> >Linux/Alpha Guru reports that the code in it assumes that sizeof(long)
> >is always 4, and one particular test doesn't "look" very random on
> >the Alpha.
> >
> >My question is, is there a better version of random that can deal
> >with both 32 and 64 bit systems in the same source code? Would
> >the NetBSD people maybe have such a thing?
>
> Try a Fibonacci-sequence random number generator (they're mentioned
> in Knuth). The general form is:
>
> X[n] = (X[n-j] + X[n-k]) mod m
I think this would be bad - for a general-purpose language like awk we
should be using a cryptographic-strength PRNG like arc4random() or
/dev/urandom so that people can use it for any purpose. 64-bit
cleanliness can presumably be taken care of easily enough.
Kris
To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message