summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormattip <matti.picus@gmail.com>2019-11-21 08:31:05 -0800
committermattip <matti.picus@gmail.com>2019-11-21 16:47:30 -0800
commita413620ed8c13efc1f513859e3140ad6922d67d0 (patch)
tree77a79eeda4ed8aa89d0166022bf0a59e58129c15
parent5a52be5d12773327f950fd67ad9268dd6ff17320 (diff)
downloadnumpy-a413620ed8c13efc1f513859e3140ad6922d67d0.tar.gz
DOC: fixes from review
-rw-r--r--doc/source/reference/random/index.rst9
-rw-r--r--doc/source/reference/random/legacy.rst16
2 files changed, 18 insertions, 7 deletions
diff --git a/doc/source/reference/random/index.rst b/doc/source/reference/random/index.rst
index 48d7a4819..bda9c4d96 100644
--- a/doc/source/reference/random/index.rst
+++ b/doc/source/reference/random/index.rst
@@ -41,13 +41,16 @@ properties than the legacy `MT19937` used in `RandomState`.
.. code-block:: python
- #Do this
+ # Do this
from numpy.random import default_rng
- val = default_rng().standard_normal()
+ rng = default_rng()
+ vals = rng.standard_normal(10)
+ more_vals = rng.standard_normal(10)
# instead of this
from numpy import random
- val = random.standard_normal()
+ vals = random.standard_normal(10)
+ more_vals = random.standard_normal(10)
`Generator` can be used as a replacement for `RandomState`. Both class
instances hold a internal `BitGenerator` instance to provide the bit
diff --git a/doc/source/reference/random/legacy.rst b/doc/source/reference/random/legacy.rst
index 9118fc052..922d76a9a 100644
--- a/doc/source/reference/random/legacy.rst
+++ b/doc/source/reference/random/legacy.rst
@@ -122,10 +122,18 @@ Distributions
~RandomState.weibull
~RandomState.zipf
-Toplevel `numpy.random` functions
-=================================
-Many of the RandomState methods above are exported as top-level `numpy.random`
-functions. These are:
+Functions in `numpy.random`
+===========================
+Many of the RandomState methods above are exported as functions in
+`numpy.random` This usage is discouraged, as it is implemented via a gloabl
+`RandomState` instance which is not advised on two counts:
+
+- It uses global state, which means results will change as the code changes
+
+- It uses a `RandomState` rather than the more modern `Generator`.
+
+For backward compatible legacy reasons, we cannot change this. See
+`random-quick-start`.
.. autosummary::
:toctree: generated/