Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 30 Mar 1996 17:29:37 +1100
From:      Bruce Evans <bde@zeta.org.au>
To:        ache@astral.msk.su, davidg@Root.COM
Cc:        current@freebsd.org, imb@scgt.oz.au
Subject:   Re: random .. not so ..
Message-ID:  <199603300629.RAA30811@godzilla.zeta.org.au>

next in thread | raw e-mail | index | archive | help
>> >I plan to aply proposed fix, if nobody against.

It needs more thought.

>>    The proposed fix was a patch to the GPL'd libc...that means that it is
>> covered by the GPL. I don't think you can use the patch directly without
>> contaminating our non-GPL'd sources.

The LGPL'ed srandom() is obviously copied from the BSD library.  This may
invalidate the LGPL.

>The proposed fix not applies directly in any case, I just plan to use
>its math formula. Moreover, we have 3 places affected:
>rand(), srandom(), random().

rand() is well known to be poor and is left that way for historical bug
for bug compatibility.  srandom() uses the same formula as rand() so it
may be poor.  This seems to be the main point of the fix.  The example
program seems to be mostly bogus.  Calling srandom() a lot defeats the
randomness of random().  For a sillier example, change the constants in
the program so that l goes up to 10000 and i is always 0.  Then
srandom() defeats() random at every step and the sequence of low bits
is `1 1 0 0 1 1 0 0 ...'

Bruce



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