freneticlib.utils.random
Module Contents
Functions
|
Once the seed is set, it is permanent, until you use reset_rng to reset. |
|
We might want to reset the RNG (for instance when testing) |
Attributes
GLOBAL_RNG (np.random.Generator) |
- freneticlib.utils.random.GLOBAL_RNG
GLOBAL_RNG (np.random.Generator) A variable storing the globally set RNG. Defaults to None before first call to seeded_rng.
- freneticlib.utils.random.seeded_rng(seed: int = None) numpy.random.Generator[source]
Once the seed is set, it is permanent, until you use reset_rng to reset. Thus, to set it, manually call it before any other function accesses.
- Parameters:
seed (int) – Which seed to use. If not, will use random seed.
- Returns:
The random number generator
- Return type:
(np.random.Generator)
- freneticlib.utils.random.reset_rng(seed: int = None) numpy.random.Generator | None[source]
We might want to reset the RNG (for instance when testing)
- Parameters:
seed (int, optional) – If we want to reinitialise the RNG, then provide this value.
- Returns:
The new random number generator, if seed was provided. Otherwise None.
- Return type:
(np.random.Generator, optional)