eradiate.rng

Components related with pseudo-random number generation.

Inspired by SeedBank.

eradiate.rng.get_seed_state()[source]

Get shared-state seed sequence. When accessed for the first time, the seed sequence is initialized with the default specified in the configuration.

Returns:

SeedState

eradiate.rng.reset_seed_state(seed=None)[source]

Reset the shared-state seed sequence.

Parameters:

seed (int, optional) – Value used to seed the sequence. If unset, the default specified in the configuration is used.

class eradiate.rng.SeedState(seed=None)[source]

Manage a root seed and facilities to derive seeds.

next(n=1)[source]

Get the next n seed values.

Parameters:

n (int) – Number of seed values to generate.

Returns:

ndarray – Generated RNG seeds.

numpy_default_rng()[source]

Return a default Numpy RNG initialized with a generated seed.

Returns:

numpy.random.Generator – Initialized RNG.

reset(seed=None)[source]

Reset the seed state.

Parameters:

seed (int or numpy.random.SeedSequence, optional) – Value used to initialize the internal seed sequence. If unset, the current seed sequence is reused, with its children spawned member reset.