diff options
Diffstat (limited to 'numpy')
-rw-r--r-- | numpy/random/mtrand/mtrand.pyx | 2 | ||||
-rw-r--r-- | numpy/random/tests/test_random.py | 6 |
2 files changed, 7 insertions, 1 deletions
diff --git a/numpy/random/mtrand/mtrand.pyx b/numpy/random/mtrand/mtrand.pyx index 0340bef62..13aa111b2 100644 --- a/numpy/random/mtrand/mtrand.pyx +++ b/numpy/random/mtrand/mtrand.pyx @@ -4226,7 +4226,7 @@ cdef class RandomState: array([15, 1, 9, 4, 12]) """ - if isinstance(x, (int, np.integer)): + if isinstance(x, (int, long, np.integer)): arr = np.arange(x) else: arr = np.array(x) diff --git a/numpy/random/tests/test_random.py b/numpy/random/tests/test_random.py index 3c0e5d422..8b5d083a3 100644 --- a/numpy/random/tests/test_random.py +++ b/numpy/random/tests/test_random.py @@ -34,6 +34,12 @@ class TestRegression(TestCase): msg = "Frequency was %f, should be < 0.23" % freq assert_(freq < 0.23, msg) + def test_permutation_longs(self): + np.random.seed(1234) + a = np.random.permutation(12) + np.random.seed(1234) + b = np.random.permutation(12L) + assert_array_equal(a, b) class TestMultinomial(TestCase): def test_basic(self): |