summaryrefslogtreecommitdiff
path: root/numpy
diff options
context:
space:
mode:
authorCharles Harris <charlesr.harris@gmail.com>2016-02-27 17:29:29 -0700
committerCharles Harris <charlesr.harris@gmail.com>2016-02-27 17:32:39 -0700
commitf6c2e7f714b56e921b8fa8cec48e37da231b66fe (patch)
treec25abf9fa63d5f4d20a27b7e96ab1bce53c2e27e /numpy
parent9b2e7ec0762ad7508847135b7eacb4e13fd16e04 (diff)
downloadnumpy-f6c2e7f714b56e921b8fa8cec48e37da231b66fe.tar.gz
DOC: Clarify the valid range of integers passed to random.seed.
Diffstat (limited to 'numpy')
-rw-r--r--numpy/random/mtrand/mtrand.pyx12
1 files changed, 6 insertions, 6 deletions
diff --git a/numpy/random/mtrand/mtrand.pyx b/numpy/random/mtrand/mtrand.pyx
index 6df2d84b9..3adeb1990 100644
--- a/numpy/random/mtrand/mtrand.pyx
+++ b/numpy/random/mtrand/mtrand.pyx
@@ -891,10 +891,10 @@ cdef class RandomState:
Parameters
----------
seed : {None, int, array_like}, optional
- Random seed initializing the pseudo-random number generator.
- Can be an integer between 0 and 4294967295, an array (or other sequence) of integers of
- any length, or ``None`` (the default).
- If `seed` is ``None``, then `RandomState` will try to read data from
+ Random seed used to initialize the pseudo-random number generator. Can
+ be any integer between 0 and 2**32 - 1 inclusive, an array (or other
+ sequence) of such integers, or ``None`` (the default). If `seed` is
+ ``None``, then `RandomState` will try to read data from
``/dev/urandom`` (or the Windows analogue) if available or seed from
the clock otherwise.
@@ -952,13 +952,13 @@ cdef class RandomState:
else:
idx = operator.index(seed)
if idx > int(2**32 - 1) or idx < 0:
- raise ValueError("Seed must be between 0 and 4294967295")
+ raise ValueError("Seed must be between 0 and 2**32 - 1")
with self.lock:
rk_seed(idx, self.internal_state)
except TypeError:
obj = np.asarray(seed).astype(np.int64, casting='safe')
if ((obj > int(2**32 - 1)) | (obj < 0)).any():
- raise ValueError("Seed must be between 0 and 4294967295")
+ raise ValueError("Seed must be between 0 and 2**32 - 1")
obj = obj.astype('L', casting='unsafe')
with self.lock:
init_by_array(self.internal_state, <unsigned long *>PyArray_DATA(obj),