Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 14 Dec 2000 22:56:00 -0800
From:      Kris Kennaway <kris@FreeBSD.ORG>
To:        Peter Jeremy <peter.jeremy@alcatel.com.au>
Cc:        hackers@FreeBSD.ORG, sheldonh@uunet.co.za, arnold@skeeve.com
Subject:   Re: BSD random for Alpha?
Message-ID:  <20001214225600.F2040@citusc.usc.edu>
In-Reply-To: <20001204092348.A92196@gsmx07.alcatel.com.au>; from peter.jeremy@alcatel.com.au on Mon, Dec 04, 2000 at 09:23:48AM %2B1100
References:  <20001204092348.A92196@gsmx07.alcatel.com.au>

next in thread | previous in thread | raw e-mail | index | archive | help
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 majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20001214225600.F2040>