File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -1191,7 +1191,7 @@ cdef class RandomState:
1191
1191
self .set_state (state )
1192
1192
1193
1193
def __reduce__ (self ):
1194
- return (mkl_random . __RandomState_ctor , (), self .get_state ())
1194
+ return (__RandomState_ctor , (), self .get_state ())
1195
1195
1196
1196
def leapfrog (self , int k , int nstreams ):
1197
1197
"""
@@ -5822,6 +5822,17 @@ cdef class RandomState:
5822
5822
return arr
5823
5823
5824
5824
5825
+ def __RandomState_ctor ():
5826
+ """Return a RandomState instance.
5827
+ This function exists solely to assist (un)pickling.
5828
+ Note that the state of the RandomState returned here is irrelevant, as this function's
5829
+ entire purpose is to return a newly allocated RandomState whose state pickle can set.
5830
+ Consequently the RandomState returned by this function is a freshly allocated copy
5831
+ with a seed=0.
5832
+ See https://github.com/numpy/numpy/issues/4763 for a detailed discussion
5833
+ """
5834
+ return RandomState (seed = 0 )
5835
+
5825
5836
_rand = RandomState ()
5826
5837
seed = _rand .seed
5827
5838
get_state = _rand .get_state
You can’t perform that action at this time.
0 commit comments