bundles / numpy 2.5.0.dev0+git20251130.2de293a / numpy / random / RandomState / get_state
cython_function_or_method
numpy.random:RandomState.get_state
Signature
def get_state ( legacy = True ) Summary
Return a tuple representing the internal state of the generator.
Extended Summary
For more details, see set_state.
Parameters
legacy: bool, optionalFlag indicating to return a legacy tuple state when the BitGenerator is MT19937, instead of a dict. Raises ValueError if the underlying bit generator is not an instance of MT19937.
Returns
out: {tuple(str, ndarray of 624 uints, int, int, float), dict}If legacy is True, the returned tuple has the following items:
the string 'MT19937'.
a 1-D array of 624 unsigned integer keys.
an integer
pos.an integer
has_gauss.a float
cached_gaussian.
If
legacyis False, or the BitGenerator is not MT19937, then state is returned as a dictionary.
Notes
set_state and get_state are not needed to work with any of the random distributions in NumPy. If the internal state is manually altered, the user should know exactly what he/she is doing.
See also
Aliases
-
numpy.random.get_state -
numpy.random.RandomState.get_state