NumPy

Previous topic

numpy.random.RandomState.set_state

Next topic

numpy.random.RandomState.rand

This is documentation for an old release of NumPy (version 1.19). Read this page in the documentation of the latest stable release (version 2.2).

numpy.random.RandomState.seed

method

RandomState.seed(self, seed=None)

Reseed a legacy MT19937 BitGenerator

Notes

This is a convenience, legacy function.

The best practice is to not reseed a BitGenerator, rather to recreate a new one. This method is here for legacy reasons. This example demonstrates best practice.

>>>
>>> from numpy.random import MT19937
>>> from numpy.random import RandomState, SeedSequence
>>> rs = RandomState(MT19937(SeedSequence(123456789)))
# Later, you want to restart the stream
>>> rs = RandomState(MT19937(SeedSequence(987654321)))