On 6/29/20 5:37 PM, Kevin Sheppard wrote:

The best practice is to use a SeedSequence to spawn child SeedSequences, and then to use these children to initialize your generators or bit generators.

 

 

from numpy.random import SeedSequence, Generator, PCG64, default_rng

 

entropy = 382193877439745928479635728

 

seed_seq = SeedSequence(entropy)

NUM_STREAMS = 2**15

children = seed_seq.spawn(NUM_STREAMS)

# if you want the current best bit generator, which may change

rngs = [default_rng(child) for child in children]

# If you want the most control across version, set the bit generator

# this uses PCG64, which is the current default. Each bit generator needs to be wrapped in a generator

rngs = [Generator(PCG64(child)) for child in children]

 

Kevin


I guess something is wrong with the docs, what can we do to make this page more discoverable?

https://numpy.org/devdocs/reference/random/parallel.html#seedsequence-spawning


Matti