diff options
author | Stefan van der Walt <stefan@sun.ac.za> | 2007-07-23 13:12:55 +0000 |
---|---|---|
committer | Stefan van der Walt <stefan@sun.ac.za> | 2007-07-23 13:12:55 +0000 |
commit | 134e4bbaa54ff7938160b8e912a06af8f63bd513 (patch) | |
tree | ed507706fbdb7dc71fbb4d63e8dba4b68034c553 /numpy/oldnumeric/random_array.py | |
parent | db593109a5f30089e888f91ac2476a6c5e968879 (diff) | |
download | numpy-134e4bbaa54ff7938160b8e912a06af8f63bd513.tar.gz |
Fix randint. Closes ticket #552.
Diffstat (limited to 'numpy/oldnumeric/random_array.py')
-rw-r--r-- | numpy/oldnumeric/random_array.py | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/numpy/oldnumeric/random_array.py b/numpy/oldnumeric/random_array.py index 0b06ee959..2f5479c1f 100644 --- a/numpy/oldnumeric/random_array.py +++ b/numpy/oldnumeric/random_array.py @@ -12,8 +12,6 @@ ArgumentError = ValueError import numpy.random.mtrand as mt import numpy as Numeric -from types import IntType - def seed(x=0, y=0): if (x == 0 or y == 0): mt.seed() @@ -42,16 +40,16 @@ def uniform(minimum, maximum, shape=[]): def randint(minimum, maximum=None, shape=[]): """randint(min, max, shape=[]) = random integers >=min, < max If max not given, random integers >= 0, <min""" - if not isinstance(minimum, IntType): + if not isinstance(minimum, int): raise ArgumentError, "randint requires first argument integer" if maximum is None: maximum = minimum minimum = 0 - if not isinstance(maximum, IntType): + if not isinstance(maximum, int): raise ArgumentError, "randint requires second argument integer" a = ((maximum-minimum)* random(shape)) - if isinstance(a, Numeric.ArrayType): - return minimum + a.astype(Numeric.Int) + if isinstance(a, Numeric.ndarray): + return minimum + a.astype(Numeric.int) else: return minimum + int(a) |