help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: rand("state")


From: Mike Miller
Subject: Re: rand("state")
Date: Fri, 17 Feb 2006 08:57:49 -0600 (CST)

On Fri, 17 Feb 2006, Michael Creel wrote:

If you search this (September or October 2005) list you'll fnd a post of mine with a script (birthday.m I believe) that performs some calculations along these lines. I was worried about the likelihood that random streams generated on the nodes of a cluster of computers might overlap. My conclusion was that the probability is so small it can be ignored, even on a large cluster. The octaves running on each node get their initial seed from /dev/random, and that combined with the extremely long period of the Mersenne Twister make overlaps very unlikely.

I couldn't find it, but I found this:

http://www.octave.org/octave-lists/archive/help-octave.2005/msg01241.html

If the use of /dev/random or /dev/urandom can produce all 19968 bits (624 32-bit integers) plus one integer in the range from 1 to 624, and these are truly random and not limited by the time when they were recorded, then I'm sure you are right. But if the seed from /dev/urandom is only a 32-bit seed, there can be collisions.

Some machines don't have /dev/random or /dev/urandom. On such machines a different mechanism is used, but is that other method adequate? I think it might fail when two processes start at exactly the same time.

Another approach would be to use one random process to generate a large number of seeds (using the code I sent yesterday), then use those seeds to initialize other processes. If you are going to do millions of such runs, the seed file will get big, but usually we don't need to start Octave that many times, probably just a few thousand times at most.

Mike



-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------



reply via email to

[Prev in Thread] Current Thread [Next in Thread]