You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: spec-0007/index.md
+5-4Lines changed: 5 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -38,13 +38,14 @@ We are primarily concerned with API uniformity, but also encourage libraries to
38
38
2. their use avoids relying on global state—which can make code execution harder to track, and may cause problems in parallel processing scenarios.
39
39
40
40
[^no-RandomState]:
41
-
Note that `numpy.random.default_rng` does not accept instances of `RandomState`, so use of `RandomState` to control the seed is effectively deprecated, too.
42
-
That said, neither `np.random.seed` nor `np.random.RandomState`_themselves_ are deprecated, so they may still be used in some contexts (e.g. by developers for generating unit test data).
41
+
Note that in NumPy versions prior to 2.2.0, `numpy.random.default_rng` does not accept instances of `RandomState`.
42
+
In more recent versions, `numpy.random.default_rng` will convert `RandomState` instances to `Generator`s, which may not behave identically even with identical method calls.
43
+
That said, neither `np.random.seed` nor `np.random.RandomState`_themselves_ are deprecated, so they may still be used directly in some contexts (e.g. by developers for generating unit test data).
43
44
44
45
### Scope
45
46
46
47
This is intended as a recommendation to all libraries that allow users to control the state of a NumPy random number generator.
47
-
It is specifically targeted toward functions that currently accept `RandomState` instances via an argument other than `rng`, or allow `numpy.random.seed` to control the random state, but the ideas are more broadly applicable.
48
+
It is specifically targeted toward functions that currently accept random number seeds using an argument other than `rng`, rely on the particular behavior of `RandomState` methods, or allow `numpy.random.seed` to control the random state, but the ideas are more broadly applicable.
48
49
Random number generators other than those provided by NumPy could also be accommodated by an `rng` keyword, but that is beyond the scope of this SPEC.
0 commit comments