statsmodels.tools.rng_qrng.check_random_state#

statsmodels.tools.rng_qrng.check_random_state(seed=None, deprecated=False, warn=True)[source]#

Turn a seed into a random number generator

Parameters:
seedint, array_like of int, numpy.random.Generator, numpy.random.RandomState, scipy.stats.qmc.QMCEngine, optional

If seed is None fresh, unpredictable entropy will be pulled from the OS and numpy.random.Generator is used. If seed is an int or array_like[ints], a new Generator instance is used, seeded with seed. If seed is already a Generator, RandomState or scipy.stats.qmc.QMCEngine instance then that instance is used.

deprecatedbool, optional

If False, returns default_rng(seed). If True, returns RandomState(seed) when seed is an int or array-like of ints.

warnbool, optional

Whether to issue a warning that the future behavior for integer or array-like seed will switch to calling default_rng(seed).

Returns:
rngnumpy.random.Generator, numpy.random.RandomState, or scipy.stats.qmc.QMCEngine

Random number generator.

Notes

scipy.stats.qmc.QMCEngine requires SciPy >=1.7. It also means that the generator only has the method random.