seed for random number generator with parallel computation
John D Salt
jdsalt_AT_gotadsl.co.uk at giganews.com
Thu Apr 23 13:25:18 EDT 2009
Eric Wajnberg <wajnberg at sophia.inra.fr> wrote in news:gsp7ns$ems$1
@anthracite.jouy.inra.fr:
[Snips]
> Can someone tell me what is the usual policy used in this case to start
> the random number generator with random seeds, that are different from
> one run to the other? Are you simply using the pid of the process each
> time to initiate the random number generator?
I don't know that it's "usual policy", but my habit is to write a little
standalone program to make a large number of calls to the PRNG, and
record the current state of the generator at regular intervals.
Obviously the exact numbers depend on the number of random draws you
expect to make in a replication, and the period of the generator, but I
tend to make a million random draws and record the seed at intervals of
10,000, so giving me in effect 100 starting seeds to choose from. In the
event that you ever draw more than 10,000 samples from a single random
stream, I suspect that any correlation effects with the random stream it
is now overlapping will be negligible.
I originally did this with CACI's SIMSCRIPT II.5 and MODSIM II, in order
to provide more than the 10 starting seeds provided "out of the box"; I
have since done it with Python, even though the Python PRNG provides a
method called jumpahead() to move far away from the current position in
the cycle. My reason is that I prefer to know the exact definition of
"far away" for these purposes.
I certainly wouldn't use a process pid as a PRNG seed, for fear of losing
repeatability. As an aside, starting with known seeds in the way
suggested offers you the chance to use antithetic variates as a variance-
reduction technique, if you care to do so.
All the best,
John.
--
In what method shall we implement the matrix of this government display
picnic?
-- Bill Bailey
More information about the comp-simulation
mailing list