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:
11911191 self .set_state (state )
11921192
11931193 def __reduce__ (self ):
1194- return (mkl_random . __RandomState_ctor , (), self .get_state ())
1194+ return (__RandomState_ctor , (), self .get_state ())
11951195
11961196 def leapfrog (self , int k , int nstreams ):
11971197 """
@@ -5822,6 +5822,17 @@ cdef class RandomState:
58225822 return arr
58235823
58245824
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+
58255836_rand = RandomState ()
58265837seed = _rand .seed
58275838get_state = _rand .get_state
You can’t perform that action at this time.
0 commit comments