Multiple Independent Random Number Streams From Single Seed
Solution 1:
Approach 3 can work, as the seed for any PRNG can be as long as that PRNG's state (for example, Mersenne Twister has a state length of 19968 bits, or 624 * 32 bits, so can accept a seed of up to that many bits — it's not limited to 32 or 64 bits, as is the practice with many APIs that implement Mersenne Twister). However you should use a PRNG of an unrelated design to Mersenne Twister, such as PCG, to seed that PRNG, then draw the 624-integer seed as you suggest. (Or, if you don't require reproducible results or if you will save the 624-integer seeds generated this way, you can use a cryptographic RNG, such as os.urandom()
or secrets.SystemRandom
, to draw those seeds instead.) My article on RNGs suggests several PRNGs with different designs.
UPDATE (Dec. 1, 2019):
If you're using NumPy, please note that in the meantime, NumPy 1.17 introduces a new random number generation system; it uses so-called bit generators, such as PCG, and random generators, such as the new numpy.random.Generator
. It was the result of a proposal to change the RNG policy. The NumPy documentation now has detailed information on seeding RNGs in parallel, and on multithreading RNGs. I also have general information on seeding multiple processes (not NumPy-specific) in "Seed Generation for Noncryptographic PRNGs."
Post a Comment for "Multiple Independent Random Number Streams From Single Seed"