diff options
author | Charles Harris <charlesr.harris@gmail.com> | 2019-07-13 10:54:07 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-07-13 10:54:07 -0500 |
commit | bebc3a658b9c21b12c76b3fcb0a578434ec7267a (patch) | |
tree | bf57a1c0b69dec889572cf5851849f690ec080a5 /doc | |
parent | 4f7d5eb13394ec2b13fe9e22855fa009579cb49b (diff) | |
parent | d8e145743813545b11be1f588f4fedb88addf059 (diff) | |
download | numpy-bebc3a658b9c21b12c76b3fcb0a578434ec7267a.tar.gz |
Merge pull request #13945 from mattip/random-diff
DOC, MAINT: emphasize random API changes, remove Generator.randint
Diffstat (limited to 'doc')
-rw-r--r-- | doc/source/reference/random/index.rst | 26 | ||||
-rw-r--r-- | doc/source/reference/random/new-or-different.rst | 8 |
2 files changed, 27 insertions, 7 deletions
diff --git a/doc/source/reference/random/index.rst b/doc/source/reference/random/index.rst index 51e72513d..7de1c838c 100644 --- a/doc/source/reference/random/index.rst +++ b/doc/source/reference/random/index.rst @@ -41,10 +41,28 @@ statistically more reliable than the legacy methods in `~.RandomState` from numpy import random random.standard_normal() -`~Generator` can be used as a direct replacement for `~.RandomState`, although -the random values are generated by `~.PCG64`. The -`~Generator` holds an instance of a BitGenerator. It is accessible as -``gen.bit_generator``. +`~Generator` can be used as a replacement for `~.RandomState`. Both class +instances now hold a internal `BitGenerator` instance to provide the bit +stream, it is accessible as ``gen.bit_generator``. Some long-overdue API +cleanup means that legacy and compatibility methods have been removed from +`~.Generator` + +=================== ============== ============ +`~.RandomState` `~.Generator` Notes +------------------- -------------- ------------ +``random_sample``, ``random`` Compatible with `random.random` +``rand`` +------------------- -------------- ------------ +``randint``, ``integers`` Add an ``endpoint`` kwarg +``random_integers`` +------------------- -------------- ------------ +``tomaxint`` removed Use ``integers(0, np.iinfo(np.int).max,`` + ``endpoint=False)`` +------------------- -------------- ------------ +``seed`` removed Use `~.SeedSequence.spawn` +=================== ============== ============ + +See `new-or-different` for more information .. code-block:: python diff --git a/doc/source/reference/random/new-or-different.rst b/doc/source/reference/random/new-or-different.rst index 4eb175d57..5442f46c9 100644 --- a/doc/source/reference/random/new-or-different.rst +++ b/doc/source/reference/random/new-or-different.rst @@ -23,10 +23,12 @@ Feature Older Equivalent Notes source, called a `BitGenerator <bit_generators>` A number of these are provided. ``RandomState`` uses - only the Mersenne Twister. + the Mersenne Twister `~.MT19937` by + default, but can also be instantiated + with any BitGenerator. ------------------ -------------------- ------------- -``random`` ``random_sample`` Access the values in a BitGenerator, - convert them to ``float64`` in the +``random`` ``random_sample``, Access the values in a BitGenerator, + ``rand`` convert them to ``float64`` in the interval ``[0.0.,`` `` 1.0)``. In addition to the ``size`` kwarg, now supports ``dtype='d'`` or ``dtype='f'``, |