[Scottish] allowing a large newborn sea-mammal to collide with
a rocky plane toid object devoid of atmosphere somewhere in another galaxy
Gordon JC Pearce
scottish at mailman.lug.org.uk
Fri Mar 21 09:18:01 2003
On Fri, 2003-03-21 at 09:06, John Hallam wrote:
> On Thu, 20 Mar 2003, Huard, Elise - D C&W Consultant wrote:
>
> > Or to phrase it differently : i need a random number generator that won't
> > give the same sequence of numbers every time that the seed is reinitialised
> > in the same second (by 2 different users)
> > srand(time(NULL))
> > and then rand()
> > doesn't work.
> > Or a different kind of seed ? Suggestions are welcome (should be readily
> > available in your standard Unix system)
>
> One thing you can do is to execute `ps' and hash the output, e.g.
> with MD5, and use some of those bits as your seed. There is enough going
> on in a PS output to make duplicate seeds rather unlikely, unless
> (perhaps) you have a multiple CPU machine which can execute multiple ps
> invocations simultaneously...
>
> As someone else said, be careful with rand() if you want good
> random sequences -- some rand()s are seriously broken. A good cheap
> random number generator is the Mersenne Twister, which you can find at
> http://www.math.keio.ac.jp/~matumoto/emt.html
>
> John.
A white noise source connected to the sound card input would be a good
truly random number generator.