diff options
Diffstat (limited to 'doc/source/reference/random')
-rw-r--r-- | doc/source/reference/random/index.rst | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/doc/source/reference/random/index.rst b/doc/source/reference/random/index.rst index 7de1c838c..5b4dcf567 100644 --- a/doc/source/reference/random/index.rst +++ b/doc/source/reference/random/index.rst @@ -32,8 +32,9 @@ instance's methods are imported into the numpy.random namespace, see Quick Start ----------- -By default, `~Generator` uses normals provided by `~pcg64.PCG64` which will be -statistically more reliable than the legacy methods in `~.RandomState` +By default, `~Generator` uses bits provided by `~pcg64.PCG64` which +has better statistical properties than the legacy mt19937 random +number generator in `~.RandomState` .. code-block:: python @@ -73,6 +74,18 @@ See `new-or-different` for more information rg.standard_normal() rg.bit_generator +Something like the following code can be used to support both ``RandomState`` +and ``Generator``, with the understanding that the interfaces are slightly +different + +.. code-block:: python + + try: + rg_integers = rg.integers + except AttributeError: + rg_integers = rg.randint + a = rg_integers(1000) + Seeds can be passed to any of the BitGenerators. The provided value is mixed via `~.SeedSequence` to spread a possible sequence of seeds across a wider range of initialization states for the BitGenerator. Here `~.PCG64` is used and |