summaryrefslogtreecommitdiff
path: root/doc/source/reference/random
diff options
context:
space:
mode:
authormattip <matti.picus@gmail.com>2019-07-13 22:20:22 -0500
committermattip <matti.picus@gmail.com>2019-07-14 15:17:45 -0500
commitf966764677b7dca46fdc46c4d7595ed2097dbc61 (patch)
treee0b9ab92951c2f69c0c378eb8199d218e735cb67 /doc/source/reference/random
parent5b0069c08d00e871d74c6533e0b0eeb3107e8f70 (diff)
downloadnumpy-f966764677b7dca46fdc46c4d7595ed2097dbc61.tar.gz
DOC: show workaround for backward compatibility
Diffstat (limited to 'doc/source/reference/random')
-rw-r--r--doc/source/reference/random/index.rst12
1 files changed, 12 insertions, 0 deletions
diff --git a/doc/source/reference/random/index.rst b/doc/source/reference/random/index.rst
index 7de1c838c..fb79e0306 100644
--- a/doc/source/reference/random/index.rst
+++ b/doc/source/reference/random/index.rst
@@ -73,6 +73,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