fatf.setup_random_seed¶
-
fatf.setup_random_seed(seed: Optional[int] = None) → None[source]¶ Sets up Python’s and numpy’s random seed.
Fixture for the tests to assure globally controllable seeding of random number generators in both Python (
random.seed) andnumpy(numpy.random.seed). The seed is taken either fromFATF_SEEDsystem variable or from theseedinput parameter; if neither of the two is given, it is sampled uniformly from 0–2147483647 range.Note
If both
FATF_SEEDsystem variable andseedinput parameter are given, theseedparameter takes the precedence.This function loggs (
info) the origin of the random seed and its value.- Parameters
- seedinteger, optional (default=None)
New in version 0.0.2.
An integer in 0–2147483647 range used to seed Python’s and numpy’s random number generator.
- Raises
- TypeError
The
seedinput parameter is not an integer.- ValueError
The
seedinput parameter is outside of the allowed 0–2147483647 range. The random seed retrieved from theFATF_SEEDsystem variable is either outside of the allowed range or cannot be parsed as an integer.