8000 DOC: Remove some Generator() calls in the documentation. · rkern/numpy@f8801a1 · GitHub
[go: up one dir, main page]

Skip to content

Commit f8801a1

Browse files
committed
DOC: Remove some Generator() calls in the documentation.
1 parent bbc52dd commit f8801a1

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

doc/source/reference/random/index.rst

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,10 @@ the random values are generated by `~PCG64`. The
5050

5151
.. code-block:: python
5252
53-
# As replacement for RandomState()
54-
from numpy.random import Generator
55-
rg = Generator()
53+
# As replacement for RandomState(); default_gen() instantiates Generator with
54+
# the default PCG64 BitGenerator.
55+
from numpy.random import default_gen
56+
rg = default_gen()
5657
rg.standard_normal()
5758
rg.bit_generator
5859

doc/source/reference/random/new-or-different.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ Feature Older Equivalent Notes
2323
source, called a `BitGenerator
2424
<bit_generators>` A number of these
2525
are provided. ``RandomState`` uses
26-
only the Box- Muller method.
26+
only the Mersenne Twister.
2727
------------------ -------------------- -------------
28-
``np.random.`` ``np.random.`` Access the values in a BitGenerator,
29-
``Generator().`` ``random_sample()`` convert them to ``float64`` in the
30-
``random()`` interval ``[0.0.,`` `` 1.0)``.
28+
``Generator.`` ``RandomState.`` Access the values in a BitGenerator,
29+
``random()`` ``random_sample()`` convert them to ``float64`` in the
30+
interval ``[0.0.,`` `` 1.0)``.
3131
In addition to the ``size`` kwarg, now
3232
supports ``dtype='d'`` or ``dtype='f'``,
3333
and an ``out`` kwarg to fill a user-
@@ -36,7 +36,7 @@ Feature Older Equivalent Notes
3636
Many other distributions are also
3737
supported.
3838
------------------ -------------------- -------------
39-
``Generator().`` ``randint``, Use the ``endpoint`` kwarg to adjust
39+
``Generator.`` ``randint``, Use the ``endpoint`` kwarg to adjust
4040
``integers()`` ``random_integers`` the inclusion or exclution of the
4141
``high`` interval endpoint
4242
================== ==================== =============
@@ -56,7 +56,7 @@ And in more detail:
5656
random numbers from a discrete uniform distribution. The ``rand`` and
5757
``randn`` methods are only available through the legacy `~.RandomState`.
5858
This replaces both ``randint`` and the deprecated ``random_integers``.
59-
* The Box-Muller used to produce NumPy's normals is no longer available.
59+
* The Box-Muller method used to produce NumPy's normals is no longer available.
6060
* All bit generators can produce doubles, uint64s and
6161
uint32s via CTypes (`~PCG64.ctypes`) and CFFI (`~PCG64.cffi`).
6262
This allows these bit generators to be used in numba.

0 commit comments

Comments
 (0)
0