Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 29 Mar 1996 11:32:15 -0800
From:      David Greenman <davidg@Root.COM>
To:        ache@astral.msk.su (aka Andrey A. Chernov, Black Mage)
Cc:        imb@scgt.oz.au (michael butler), current@freebsd.org
Subject:   Re: random .. not so .. 
Message-ID:  <199603291932.LAA02763@Root.COM>
In-Reply-To: Your message of "Fri, 29 Mar 1996 16:46:22 %2B0300." <199603291346.QAA00701@astral.msk.su> 

next in thread | previous in thread | raw e-mail | index | archive | help
>> >    BSD:    state[i] = 1103515245 * state[i - 1] + 12345;
>> >    Linux:  state[i] = 1103515145 * state[i - 1] + 12345;
>> >			      ^
>> That line is utterly WRONG in BOTH implementations.  The state it creates
>> is so incredibly UNRANDOM, that seeding is almost pointless.  The following
>> program outputs a PBM image showing a bit in the result of successive calls
>> to random(), for consecutive values of srandom().  
>> 
>> The results are TERRIBLE (for example, the 151st value returned by random()
>> is 0 for seed 0..14, then 1 for seed 15..30, then 0 for seed 31..46, etc.)
>
>Yes, the bug really hits, here is some of FreeBSD-current results,
>very visible patterns exists. They created by proposed program:
>a | split -l 100; paste x[a-b]* | tr -d "\t"
>
>I plan to aply proposed fix, if nobody against.

   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.

-DG

David Greenman
Core-team/Principal Architect, The FreeBSD Project



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