diff options
author | Charles Harris <charlesr.harris@gmail.com> | 2019-07-14 16:58:32 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-07-14 16:58:32 -0500 |
commit | f6358a9b3a6e1fd12dae0196774e7196087f7d7d (patch) | |
tree | 82b0754ddd66b65fb17314cf9d5ef5eac4b6cd07 /doc/source/reference | |
parent | 6226e1b893c84948001abdc8823209f57c8530f9 (diff) | |
parent | f966764677b7dca46fdc46c4d7595ed2097dbc61 (diff) | |
download | numpy-f6358a9b3a6e1fd12dae0196774e7196087f7d7d.tar.gz |
Merge pull request #13985 from mattip/doc-how
DOC: show workaround for backward compatibility
Diffstat (limited to 'doc/source/reference')
-rw-r--r-- | doc/source/reference/random/index.rst | 12 |
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 |