rxn.utilities.basic.sandboxed_random_context

rxn.utilities.basic.sandboxed_random_context()[source]

Enter a context that will not affect the Python random state.

This works by saving the random state at the beginning of the context and resetting it when exiting the context.

Examples

>>> with sandboxed_random_context():
...     _ = random.random()  # has no effect outside of the context
Return type

Iterator[None]