SeedSequece from NumPy if available, and only falls back to a vendored
copy if not. The correct import location is
randomgen.seed_sequence which handles to
selection of the correct
None, *, spawn_key=
SeedSequence mixes sources of entropy in a reproducible way to set the initial state for independent and very probably non-overlapping BitGenerators.
Once the SeedSequence is instantiated, you can call the generate_state method to get an appropriately sized seed. Calling spawn(n) <spawn> will create
nSeedSequences that can be used to seed independent BitGenerators, i.e. for different threads.
The entropy for creating a SeedSequence.
A third source of entropy, used internally when calling SeedSequence.spawn
Size of the pooled entropy to store. Default is 4 to give a 128-bit entropy pool. 8 (for 256 bits) is another reasonable choice if working with larger PRNGs, but there is very little to be gained by selecting another value.
The number of children already spawned. Only pass this if reconstructing a SeedSequence from a serialized form.
Best practice for achieving reproducible bit streams is to use the default
Nonefor the initial entropy, and then use SeedSequence.entropy to log/pickle the entropy for reproducibility:
>>> sq1 = np.random.SeedSequence() >>> sq1.entropy 243799254704924441050048792905230269161 # random >>> sq2 = np.random.SeedSequence(sq1.entropy) >>> np.all(sq1.generate_state(10) == sq2.generate_state(10)) True
Using a SeedSequence¶
Return the requested number of words for PRNG seeding.
Spawn a number of child SeedSequence instances by extending the spawn_key.
Get the state of the SeedSequence