1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
--- contrib/python/numpy/py2/numpy/random/__init__.py (index)
+++ contrib/python/numpy/py2/numpy/random/__init__.py (working tree)
@@ -146,7 +146,7 @@ with warnings.catch_warnings():
ranf = random = sample = random_sample
__all__.extend(['ranf', 'random', 'sample'])
-def __RandomState_ctor():
+def _RandomState_ctor():
"""Return a RandomState instance.
This function exists solely to assist (un)pickling.
--- contrib/python/numpy/py2/numpy/random/mtrand/mtrand.pyx (index)
+++ contrib/python/numpy/py2/numpy/random/mtrand/mtrand.pyx (working tree)
@@ -813,7 +813,7 @@ cdef class RandomState:
self.set_state(state)
def __reduce__(self):
- return (np.random.__RandomState_ctor, (), self.get_state())
+ return (np.random._RandomState_ctor, (), self.get_state())
# Basic distributions:
def random_sample(self, size=None):
@@ -990,7 +990,7 @@ cdef class RandomState:
raise ValueError("high is out of bounds for %s" % dtype)
if ilow >= ihigh and np.prod(size) != 0:
raise ValueError("Range cannot be empty (low >= high) unless no samples are taken")
-
+
with self.lock:
ret = randfunc(ilow, ihigh - 1, size, self.state_address)
@@ -4919,7 +4919,7 @@ cdef class RandomState:
return arr
arr = np.asarray(x)
-
+
# shuffle has fast-path for 1-d
if arr.ndim == 1:
# Return a copy if same memory
@@ -4932,7 +4932,7 @@ cdef class RandomState:
idx = np.arange(arr.shape[0], dtype=np.intp)
self.shuffle(idx)
return arr[idx]
-
+
_rand = RandomState()
seed = _rand.seed
|