If I have a numpy.random.Generator, what's the best way to inspect the BitGenerator used internally? And does the BitGenerator have any state that impacts what numbers are generated?
How to inspect BitGenerator state in a numpy.random.Generator object?
161 views Asked by william_grisaitis At
2
There are 2 answers
0
On
I know it's lame to answer my own question but i did just figure out that _bit_generator is an attribute of Generator objects:
>>> import numpy as np
>>> rng = np.random.default_rng(seed=0)
>>> print(rng._bit_generator)
<numpy.random._pcg64.PCG64 at 0x7f97c7bb7b90>
>>> print(rng._bit_generator.state)
{'bit_generator': 'PCG64',
'state': {'state': 35399562948360463058890781895381311971,
'inc': 87136372517582989555478159403783844777},
'has_uint32': 0,
'uinteger': 0}
With a generator in my test work space
After creating some random numbers the
statechanges