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

Skip to content

DOC: recommend numpy random number generator class #23221

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 1 commit into from
Jun 8, 2022
Merged
Changes from all commits
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
6 changes: 4 additions & 2 deletions doc/devel/testing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,12 @@ Random data in tests
Random data is a very convenient way to generate data for examples,
however the randomness is problematic for testing (as the tests
must be deterministic!). To work around this set the seed in each test.
For numpy use::
For numpy's default random number generator use::

import numpy as np
np.random.seed(19680801)
rng = np.random.default_rng(19680801)

and then use ``rng`` when generating the random numbers.

The seed is John Hunter's birthday.

Expand Down