[SciPy-dev] Monte Carlo package
Robert Kern
robert.kern at gmail.com
Wed Jan 25 10:41:23 CST 2006
Ed Schofield wrote:
> If by 'scientific use' you mean cryptography, I'd agree with you. But
> for most Monte Carlo applications (yes, scientific ones) a
> user-definable seed is a luxury, not a necessity.
Let me give an example. At this year's Scipy conference, Fernando Pérez gave a
demonstration of the parallel features of the development branch of ipython. He
sent code to a small cluster of machines to generate random numbers, do some
computation and return the results to his computer at the conference. He had to
send different code fragments to each machine with different time.sleep(x) calls
such that the old RANLIB PRNG would get different seeds. Otherwise, all 10
machines would have generated the same data and the same results.
Now, giving each stream a different seed is not the ideal way to implement
parallel streams of pseudorandom numbers, but it's not terribly bad, either. In
the absence of a PRNG designed for parallel use, it's a reasonable compromise.
Another would be to leapfrog the streams (for N streams, stream i will generate
N numbers and take the i'th number and discard the rest each time it needs a
sample), but that also requires each stream to have been initialized with the
same seed.
This is why I think controlling the seed is a fundamental capability of
pseudorandom samplers, and that we shouldn't be including samplers without that
capability.
--
Robert Kern
robert.kern at gmail.com
"In the fields of hell where the grass grows high
Are the graves of dreams allowed to die."
-- Richard Harter
More information about the Scipy-dev
mailing list