8000 Merge pull request #1 from mattip/make-refs · rkern/numpy@4bdaa9b · GitHub
[go: up one dir, main page]

Skip to content

Commit 4bdaa9b

Browse files
authored
Merge pull request #1 from mattip/make-refs
DOC: fix reference links
2 parents 6b3e58a + 73ae703 commit 4bdaa9b

File tree

2 files changed

+21
-21
lines changed

2 files changed

+21
-21
lines changed

doc/source/reference/random/index.rst

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -20,27 +20,27 @@ Since Numpy version 1.17.0 the Generator can be initialized with a
2020
number of different BitGenerators. It exposes many different probability
2121
distributions. See `NEP 19 <https://www.numpy.org/neps/
2222
nep-0019-rng-policy.html>`_ for context on the updated random Numpy number
23-
routines. The legacy `~RandomState` random number routines are still
23+
routines. The legacy `.RandomState` random number routines are still
2424
available, but limited to a single BitGenerator.
2525

26-
For convenience and backward compatibility, a single `~RandomState`
26+
For convenience and backward compatibility, a single `~.RandomState`
2727
instance's methods are imported into the numpy.random namespace, see
2828
:ref:`legacy` for the complete list.
2929

3030
Quick Start
3131
-----------
3232

33-
By default, `~Generator` uses normals provided by `~PCG64` which will be
34-
statistically more reliable than the legacy methods in `~RandomState`
33+
By default, `~Generator` uses normals provided by `~pcg64.PCG64` which will be
34+
statistically more reliable than the legacy methods in `~.RandomState`
3535

3636
.. code-block:: python
3737
3838
# Uses the old numpy.random.RandomState
3939
from numpy import random
4040
random.standard_normal()
4141
42-
`~Generator` can be used as a direct replacement for `~RandomState`, although
43-
the random values are generated by `~PCG64`. The
42+
`~Generator` can be used as a direct replacement for `~.RandomState`, although
43+
the random values are generated by `~.PCG64`. The
4444
`~Generator` holds an instance of a BitGenerator. It is accessible as
4545
``gen.bit_generator``.
4646

@@ -66,7 +66,7 @@ is wrapped with a `~.Generator`.
6666
Introduction
6767
------------
6868
The new infrastructure takes a different approach to producing random numbers
69-
from the `RandomState` object. Random number generation is separated into
69+
from the `~.RandomState` object. Random number generation is separated into
7070
two components, a bit generator and a random generator.
7171

7272
The `BitGenerator` has a limited set of responsibilities. It manages state
@@ -79,8 +79,8 @@ distributions, e.g., simulated normal random values. This structure allows
7979
alternative bit generators to be used with little code duplication.
8080

8181
The `Generator` is the user-facing object that is nearly identical to
82-
`RandomState`. The canonical method to initialize a generator passes a
83-
`~pcg64.PCG64` bit generator as the sole argument.
82+
`.RandomState`. The canonical method to initialize a generator passes a
83+
`~.PCG64` bit generator as the sole argument.
8484

8585
.. code-block:: python
8686
@@ -105,9 +105,9 @@ What's New or Different
105105
The Box-Muller method used to produce NumPy's normals is no longer available
106106
in `Generator`. It is not possible to reproduce the exact random
107107
values using Generator for the normal distribution or any other
108-
distribution that relies on the normal such as the `numpy.random.gamma` or
109-
`numpy.random.standard_t`. If you require bitwise backward compatible
110-
streams, use `RandomState`.
108+
distribution that relies on the normal such as the `.RandomState.gamma` or
109+
`.RandomState.standard_t`. If you require bitwise backward compatible
110+
streams, use `.RandomState`.
111111

112112
* The Generator's normal, exponential and gamma functions use 256-step Ziggurat
113113
methods which are 2-10 times faster than NumPy's Box-Muller or inverse CDF
@@ -121,9 +121,8 @@ What's New or Different
121121
source of randomness that is used in cryptographic applications (e.g.,
122122
``/dev/urandom`` on Unix).
123123
* All BitGenerators can produce doubles, uint64s and uint32s via CTypes
124-
(`~PCG64.ctypes`) and CFFI
125-
(:meth:`~PCG64.cffi`). This allows the bit generators to
126-
be used in numba.
124+
(`~.PCG64.ctypes`) and CFFI (`~.PCG64.cffi`). This allows the bit generators
125+
to be used in numba.
127126
* The bit generators can be used in downstream projects via
128127
:ref:`Cython <randomgen_cython>`.
129128
* `~.Generator.integers` is now the canonical way to generate integer
@@ -132,8 +131,9 @@ What's New or Different
132131
The ``endpoint`` keyword can be used to specify open or closed intervals.
133132
This replaces both ``randint`` and the deprecated ``random_integers``.
134133
* `~.Generator.random` is now the canonical way to generate floating-point
135-
random numbers, which replaces `random_sample`, `sample`, and `ranf`. This
136-
is consistent with Python's `random.random`.
134+
random numbers, which replaces `.RandomState.random_sample`,
135+
`.RandomState.sample`, and `.RandomState.ranf`. This is consistent with
136+
Python's `random.random`.
137137
* All BitGenerators in numpy use `~SeedSequence` to convert seeds into
138138
initialized states.
139139

doc/source/reference/random/performance.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ even on 32-bit processes, this is your choice.
2323

2424
:class:`~mt19937.MT19937` `fails some statistical tests`_ and is not especially
2525
fast compared to modern PRNGs. For these reasons, we mostly do not recommend
26-
using it on its own, only through the legacy `~mtrand.RandomState` for
26+
using it on its own, only through the legacy `~.RandomState` for
2727
reproducing old results. That said, it has a very long history as a default in
2828
many systems.
2929

@@ -40,13 +40,13 @@ faster generators.
4040
Integer performance has a similar ordering.
4141

4242
The pattern is similar for other, more complex generators. The normal
43-
performance of the legacy :class:`~mtrand.RandomState` generator is much
43+
performance of the legacy :class:`~.RandomState` generator is much
4444
lower than the other since it uses the Box-Muller transformation rather
4545
than the Ziggurat generator. The performance gap for Exponentials is also
4646
large due to the cost of computing the log function to invert the CDF.
4747
The column labeled MT19973 is used the same 32-bit generator as
48-
:class:`~mtrand.RandomState` but produces random values using
49-
:class:`~generator.Generator`.
48+
:class:`~.RandomState` but produces random values using
49+
:class:`~Generator`.
5050

5151
.. csv-table::
5252
:header: ,PCG64,MT19937,Philox,RandomState

0 commit comments

Comments
 (0)
0