---- Original Message ---- From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: Re: [Scottish] allowing a large newborn sea-mammal to collide with a rocky plane toid object devoid of atmosphere somewhere in another galaxy Date: Fri, 21 Mar 2003 09:48:39 -0000 (GMT)
>> 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. >> > >Now all we need to be able to do is create a true white noise source. >Probably the best way to achieve this is to get a computer with a >good >software random number generator to produce random numbers and output >them >from a soundcard :). > Alternately we could just select anythng from this list and hash that. Of course the selection would have to be at random .... ;-) Colin (the other one). _______________________________________________ Scottish mailing list [EMAIL PROTECTED] http://mailman.lug.org.uk/mailman/listinfo/scottish
