# 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) and numpy (numpy.random.seed). The seed is taken either from FATF_SEED system variable or from the seed input parameter; if neither of the two is given, it is sampled uniformly from 0–2147483647 range.

Note

If both FATF_SEED system variable and seed input parameter are given, the seed parameter 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 seed input parameter is not an integer.

ValueError

The seed input parameter is outside of the allowed 0–2147483647 range. The random seed retrieved from the FATF_SEED system variable is either outside of the allowed range or cannot be parsed as an integer.