Subject: Re: arc4random(9)
To: Perry E. Metzger <>
From: Thor Lancelot Simon <>
List: tech-kern
Date: 05/29/2002 10:28:17
On Wed, May 29, 2002 at 10:15:56AM -0400, Perry E. Metzger wrote:
> Thor Lancelot Simon <> writes:
> > On Tue, May 28, 2002 at 08:23:31PM -0400, Perry E. Metzger wrote:
> > > I agree modulo one thing: RC4 is actually more or less as fast as
> > > random() once initialized, so there is no real point in using random()
> > > -- an RC4 based generator would actually work better and produce much
> > > nicer data for things like monte carlo generators.
> > 
> > Well, then, let's just call it "random()".
> Yup -- modulo the fact that I think (I may be mistaken) that Posix may
> specify the algorithm.

For the random-number generator in the *kernel*?

Incidentally, have a look at the way the reseeding works -- it seems
needlessly complex, and that worries me (why not a simple rekeying with
a new random key?).  Do you agree that it ought to toss the first N bytes 
every time it reseeds, if it should even reseed at all?  Perhaps I'm
missing some reason why the reseeding being done is different than the
initial keying of the generator, but I don't think so...

(The file is src/sys/lib/libkern/arc4random.c; the whole file is only
 about 100 lines long)