Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 31 Mar 1996 13:20:26 +1000
From:      Bruce Evans <bde@zeta.org.au>
To:        ache@astral.msk.su, bde@zeta.org.au
Cc:        current@FreeBSD.org, davidg@Root.COM, imb@scgt.oz.au
Subject:   Re: random .. not so ..
Message-ID:  <199603310320.NAA08023@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.

>What thought exactly do you mean?

Think about rereading Knuth :-).

>Calling srandom(time() f.e.) is common case. Without this fix two
>programs calling srandom in _different_ times produces very predictable
>almost same sequences.

This must be a poor way to initialize random().  First, time() isn't
random.  Second, srandom() isn't claimed to give a state that varies
randomly with its arg.  In fact, it doesn't.  Third, and more
fundamentally, only 2**32 of random()'s (more than) 2**69 states are
reachable using srandom().

Bruce



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