diff options
| author | markdepristo <mdepristo@synapdx.com> | 2014-06-02 14:47:35 -0400 |
|---|---|---|
| committer | markdepristo <mdepristo@synapdx.com> | 2014-06-02 14:47:35 -0400 |
| commit | 41dc794935e6b01ab0427c054e930a23e4429e4a (patch) | |
| tree | 6b5364980a026a99eaf31b0c17de79df336ac908 /numpy | |
| parent | b1c69df01b673cc086065112da6780d8548a0dfa (diff) | |
| download | numpy-41dc794935e6b01ab0427c054e930a23e4429e4a.tar.gz | |
Optimization for pickling random states
-- Addresses https://github.com/numpy/numpy/issues/4763
Diffstat (limited to 'numpy')
| -rw-r--r-- | numpy/random/__init__.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/numpy/random/__init__.py b/numpy/random/__init__.py index 614b25a1c..388267c97 100644 --- a/numpy/random/__init__.py +++ b/numpy/random/__init__.py @@ -106,8 +106,16 @@ def __RandomState_ctor(): """Return a RandomState instance. This function exists solely to assist (un)pickling. + + Note that the state of the RandomState returned here is irrelevant, as this function's + entire purpose is to return a newly allocated RandomState whose state pickle can set. + Consequently the RandomState returned by this function is a freshly allocated copy + with a seed=0. + + See https://github.com/numpy/numpy/issues/4763 for a detailed discussion + """ - return RandomState() + return RandomState(seed=0) from numpy.testing import Tester test = Tester().test |
