summaryrefslogtreecommitdiff
path: root/doc/source/reference/random
diff options
context:
space:
mode:
authorRobert Kern <robert.kern@gmail.com>2019-06-27 15:39:17 -0700
committerGitHub <noreply@github.com>2019-06-27 15:39:17 -0700
commit4bdaa9b7bafcdc2f81df18057dea7619cfeeec2c (patch)
tree637659cdc6386f57a2f1cf77adefdca42ed2c87e /doc/source/reference/random
parent6b3e58acbba8b93600de303031a9e0a001a040ea (diff)
parent73ae703f11c3a07e50ba6c4c57e49231d9a8a87f (diff)
downloadnumpy-4bdaa9b7bafcdc2f81df18057dea7619cfeeec2c.tar.gz
Merge pull request #1 from mattip/make-refs
DOC: fix reference links
Diffstat (limited to 'doc/source/reference/random')
-rw-r--r--doc/source/reference/random/index.rst34
-rw-r--r--doc/source/reference/random/performance.rst8
2 files changed, 21 insertions, 21 deletions
diff --git a/doc/source/reference/random/index.rst b/doc/source/reference/random/index.rst
index dca2bc2a6..b122e6bc0 100644
--- a/doc/source/reference/random/index.rst
+++ b/doc/source/reference/random/index.rst
@@ -20,18 +20,18 @@ Since Numpy version 1.17.0 the Generator can be initialized with a
number of different BitGenerators. It exposes many different probability
distributions. See `NEP 19 <https://www.numpy.org/neps/
nep-0019-rng-policy.html>`_ for context on the updated random Numpy number
-routines. The legacy `~RandomState` random number routines are still
+routines. The legacy `.RandomState` random number routines are still
available, but limited to a single BitGenerator.
-For convenience and backward compatibility, a single `~RandomState`
+For convenience and backward compatibility, a single `~.RandomState`
instance's methods are imported into the numpy.random namespace, see
:ref:`legacy` for the complete list.
Quick Start
-----------
-By default, `~Generator` uses normals provided by `~PCG64` which will be
-statistically more reliable than the legacy methods in `~RandomState`
+By default, `~Generator` uses normals provided by `~pcg64.PCG64` which will be
+statistically more reliable than the legacy methods in `~.RandomState`
.. code-block:: python
@@ -39,8 +39,8 @@ 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` 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``.
@@ -66,7 +66,7 @@ is wrapped with a `~.Generator`.
Introduction
------------
The new infrastructure takes a different approach to producing random numbers
-from the `RandomState` object. Random number generation is separated into
+from the `~.RandomState` object. Random number generation is separated into
two components, a bit generator and a random generator.
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
alternative bit generators to be used with little code duplication.
The `Generator` is the user-facing object that is nearly identical to
-`RandomState`. The canonical method to initialize a generator passes a
-`~pcg64.PCG64` bit generator as the sole argument.
+`.RandomState`. The canonical method to initialize a generator passes a
+`~.PCG64` bit generator as the sole argument.
.. code-block:: python
@@ -105,9 +105,9 @@ What's New or Different
The Box-Muller method used to produce NumPy's normals is no longer available
in `Generator`. It is not possible to reproduce the exact random
values using Generator for the normal distribution or any other
- distribution that relies on the normal such as the `numpy.random.gamma` or
- `numpy.random.standard_t`. If you require bitwise backward compatible
- streams, use `RandomState`.
+ distribution that relies on the normal such as the `.RandomState.gamma` or
+ `.RandomState.standard_t`. If you require bitwise backward compatible
+ streams, use `.RandomState`.
* The Generator's normal, exponential and gamma functions use 256-step Ziggurat
methods which are 2-10 times faster than NumPy's Box-Muller or inverse CDF
@@ -121,9 +121,8 @@ What's New or Different
source of randomness that is used in cryptographic applications (e.g.,
``/dev/urandom`` on Unix).
* All BitGenerators can produce doubles, uint64s and uint32s via CTypes
- (`~PCG64.ctypes`) and CFFI
- (:meth:`~PCG64.cffi`). This allows the bit generators to
- be used in numba.
+ (`~.PCG64.ctypes`) and CFFI (`~.PCG64.cffi`). This allows the bit generators
+ to be used in numba.
* The bit generators can be used in downstream projects via
:ref:`Cython <randomgen_cython>`.
* `~.Generator.integers` is now the canonical way to generate integer
@@ -132,8 +131,9 @@ What's New or Different
The ``endpoint`` keyword can be used to specify open or closed intervals.
This replaces both ``randint`` and the deprecated ``random_integers``.
* `~.Generator.random` is now the canonical way to generate floating-point
- random numbers, which replaces `random_sample`, `sample`, and `ranf`. This
- is consistent with Python's `random.random`.
+ random numbers, which replaces `.RandomState.random_sample`,
+ `.RandomState.sample`, and `.RandomState.ranf`. This is consistent with
+ Python's `random.random`.
* All BitGenerators in numpy use `~SeedSequence` to convert seeds into
initialized states.
diff --git a/doc/source/reference/random/performance.rst b/doc/source/reference/random/performance.rst
index 7121129d4..e22e36a50 100644
--- a/doc/source/reference/random/performance.rst
+++ b/doc/source/reference/random/performance.rst
@@ -23,7 +23,7 @@ even on 32-bit processes, this is your choice.
:class:`~mt19937.MT19937` `fails some statistical tests`_ and is not especially
fast compared to modern PRNGs. For these reasons, we mostly do not recommend
-using it on its own, only through the legacy `~mtrand.RandomState` for
+using it on its own, only through the legacy `~.RandomState` for
reproducing old results. That said, it has a very long history as a default in
many systems.
@@ -40,13 +40,13 @@ faster generators.
Integer performance has a similar ordering.
The pattern is similar for other, more complex generators. The normal
-performance of the legacy :class:`~mtrand.RandomState` generator is much
+performance of the legacy :class:`~.RandomState` generator is much
lower than the other since it uses the Box-Muller transformation rather
than the Ziggurat generator. The performance gap for Exponentials is also
large due to the cost of computing the log function to invert the CDF.
The column labeled MT19973 is used the same 32-bit generator as
-:class:`~mtrand.RandomState` but produces random values using
-:class:`~generator.Generator`.
+:class:`~.RandomState` but produces random values using
+:class:`~Generator`.
.. csv-table::
:header: ,PCG64,MT19937,Philox,RandomState