numpy 1.22.4 Pypi GitHub Homepage
Other Docs
NotesParametersBackRef
RandomState(seed=None)

RandomState and Generator expose a number of methods for generating random numbers drawn from a variety of probability distributions. In addition to the distribution-specific arguments, each method takes a keyword argument size that defaults to None . If size is None , then a single value is generated and returned. If size is an integer, then a 1-D array filled with generated values is returned. If size is a tuple, then an array with that shape is filled and returned.

Compatibility Guarantee

A fixed bit generator using a fixed seed and a fixed series of calls to 'RandomState' methods using the same parameters will always produce the same results up to roundoff error except when the values were incorrect. RandomState is effectively frozen and will only receive updates that are required by changes in the the internals of Numpy. More substantial changes, including algorithmic improvements, are reserved for Generator .

Notes

The Python stdlib module "random" also contains a Mersenne Twister pseudo-random number generator with a number of methods that are similar to the ones available in RandomState . RandomState , besides being NumPy-aware, has the advantage that it provides a much larger number of probability distributions to choose from.

Parameters

seed : {None, int, array_like, BitGenerator}, optional

Random seed used to initialize the pseudo-random number generator or an instantized BitGenerator. If an integer or array, used as a seed for the MT19937 BitGenerator. Values can be any integer between 0 and 2**32 - 1 inclusive, an array (or other sequence) of such integers, or None (the default). If :None:None:`seed` is None , then the MT19937 BitGenerator is initialized by reading data from /dev/urandom (or the Windows analogue) if available or seed from the clock otherwise.

Container for the slow Mersenne Twister pseudo-random number generator. Consider using a different BitGenerator with the Generator container instead.

See Also

Generator
MT19937
numpy.random.BitGenerator

Examples

See :

Back References

The following pages refer to to this document either explicitly or contain code examples using this.

networkx.utils.misc.create_random_state scipy.optimize._optimize.check_grad scipy.optimize._basinhopping.basinhopping dask.array.random.RandomState.tomaxint networkx.utils.decorators.np_random_state scipy.optimize._basinhopping.RandomDisplacement scipy.linalg._sketches.cwt_matrix scipy.optimize._dual_annealing.StrategyChain numpy.random.mtrand.RandomState scipy.optimize._dual_annealing.dual_annealing scipy.sparse.linalg._eigen._svds.svds scipy.sparse._construct.random scipy.optimize._differentialevolution.DifferentialEvolutionSolver scipy.optimize._basinhopping.Metropolis numpy.random networkx.convert_matrix.from_pandas_edgelist scipy.optimize._qap.quadratic_assignment scipy.linalg._sketches.clarkson_woodruff_transform scipy.optimize._dual_annealing.VisitingDistribution scipy._lib._util.check_random_state scipy.spatial.distance.directed_hausdorff scipy.linalg.interpolative.seed networkx.utils.decorators.random_state scipy.optimize._differentialevolution.differential_evolution scipy.sparse._construct.rand

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


GitHub : /numpy/random/mtrand.cpython-39-darwin.so#None
type: <class 'type'>
Commit: