Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
DOC: fixes from review
  • Loading branch information
mattip committed Nov 22, 2019
commit a413620ed8c13efc1f513859e3140ad6922d67d0
9 changes: 6 additions & 3 deletions doc/source/reference/random/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 12 additions & 4 deletions doc/source/reference/random/legacy.rst
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,18 @@ Distributions
~RandomState.weibull
~RandomState.zipf

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add the legacy functions below so they are linked into the intersphinx index

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/
Expand Down