On Sun, Feb 02, 2003 at 16:42:25 +0300, Andrey A. Chernov wrote:
> On Mon, Feb 03, 2003 at 00:17:35 +1100, Tim Robbins wrote:
> >
> > I believe that this change just moves the "bad" seed to 123459876; after
> > calling srand() with that seed, each call to rand() returns 0.
>
> Yes. Nothing better is possible for this formulae and this is documented
> in algorithm, some value must be excluded. Excluding 0 is bad only because
> srand(0) is commonly used and srand(123459876) is not.
This workaround can be improved more, to make generator not stuck ever
with 123459876 by simple way:
if (seed == 123459876)
seed = 123459877;
It can be done even with original variant using more simpler patch:
if (seed == 0)
seed = 123459876;
I'll produce and send it a bit later.
--
Andrey A. Chernov
http://ache.pp.ru/
To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message