8000 DOC: np.random documentation cleanup and expansion. by rkern · Pull Request #13849 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

DOC: np.random documentation cleanup and expansion. #13849

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Jun 28, 2019
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: clean up examples.
  • Loading branch information
rkern committed Jun 27, 2019
commit 5b0d1b56e334bc9b83e1ba6bf5a557788a8fd5bf
2 changes: 1 addition & 1 deletion doc/source/reference/random/bit_generators/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ user, which is up to you.
# If the user did not provide a seed, it should return `None`.
seed = get_user_seed()
ss = SeedSequence(seed)
print(f'seed = {ss.entropy}')
print('seed = {}'.format(ss.entropy))
bg = PCG64(ss)

.. end_block
Expand Down
17 changes: 9 additions & 8 deletions doc/source/reference/random/legacy.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,27 +23,28 @@ Although we provide the `~mt19937.MT19937` BitGenerator for use independent of
rather than the legacy seeding algorithm. `~mtrand.RandomState` will use the
legacy seeding algorithm. The methods to use the legacy seeding algorithm are
currently private as the main reason to use them is just to implement
`~mtrand.RandomState`.
`~mtrand.RandomState`. However, one can reset the state of `~mt19937.MT19937`
using the state of the `~mtrand.RandomState`:

.. code-block:: python

from numpy.random import MT19937
from numpy.random import RandomState

# Use same seed
rs = RandomState(12345)
mt19937 = MT19937(12345)
lg = RandomState(mt19937)
mt19937 = MT19937()
mt19937.state = rs.get_state()
rs2 = RandomState(mt19937)

# Different output, sorry.
# Same output
rs.standard_normal()
lg.standard_normal()
rs2.standard_normal()

rs.random()
lg.random()
rs2.random()

rs.standard_exponential()
lg.standard_exponential()
rs2.standard_exponential()


.. currentmodule:: numpy.random.mtrand
Expand Down
0