rxn.utilities.basic.temporary_random_seed

rxn.utilities.basic.temporary_random_seed(seed)[source]

Set a random seed in a context, to avoid side effects.

Examples

>>> with temporary_random_seed(101):
...     # ``a`` will always have the same value
...     a = random.random()
Parameters

seed (Optional[int]) – seed, directly forwarded to random.seed(). None means using the system time.

Return type

Iterator[None]