numpy 1.22.4 Pypi GitHub Homepage
Other Docs
NotesParametersBackRef
SeedSequence(entropy=None, *, spawn_key=(), pool_size=4)

Once the SeedSequence is instantiated, you can call the generate_state method to get an appropriately sized seed. Calling spawn(n) will create n SeedSequences that can be used to seed independent BitGenerators, i.e. for different threads.

Notes

Best practice for achieving reproducible bit streams is to use the default None for the initial entropy, and then use :None:None:`SeedSequence.entropy` to log/pickle the :None:None:`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

Parameters

entropy : {None, int, sequence[int]}, optional

The entropy for creating a SeedSequence .

spawn_key : {(), sequence[int]}, optional

A third source of entropy, used internally when calling SeedSequence.spawn

pool_size : {int}, optional

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.

n_children_spawned : {int}, optional

The number of children already spawned. Only pass this if reconstructing a SeedSequence from a serialized form.

SeedSequence mixes sources of entropy in a reproducible way to set the initial state for independent and very probably non-overlapping BitGenerators.

Examples

See :

Back References

The following pages refer to to this document either explicitly or contain code examples using this.

numpy.random.bit_generator.BitGenerator numpy.random.bit_generator.SeedlessSeedSequence numpy.random._pcg64.PCG64DXSM numpy.random._sfc64.SFC64 numpy.random._philox.Philox numpy.random._generator.default_rng numpy.random._mt19937.MT19937 numpy.random.bit_generator.SeedSequence numpy.random.bit_generator.ISpawnableSeedSequence.spawn numpy.random.bit_generator.ISeedSequence numpy.random._pcg64.PCG64

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


GitHub : /numpy/random/bit_generator.cpython-39-darwin.so#None
type: <class 'type'>
Commit: