diff --git a/numpy/random/mtrand.pyx b/numpy/random/mtrand.pyx index 3f73981cd918..7e81223153d1 100644 --- a/numpy/random/mtrand.pyx +++ b/numpy/random/mtrand.pyx @@ -1130,7 +1130,7 @@ cdef class RandomState: "instead".format(low=low, high=high)), DeprecationWarning) - return self.randint(low, high + 1, size=size, dtype='l') + return self.randint(low, int(high) + 1, size=size, dtype='l') # Complicated, continuous distributions: def standard_normal(self, size=None): diff --git a/numpy/random/tests/test_randomstate.py b/numpy/random/tests/test_randomstate.py index 8d10823d6a57..50f226386219 100644 --- a/numpy/random/tests/test_randomstate.py +++ b/numpy/random/tests/test_randomstate.py @@ -436,6 +436,14 @@ def test_random_integers_max_int(self): desired = np.iinfo('l').max assert_equal(actual, desired) + with suppress_warnings() as sup: + w = sup.record(DeprecationWarning) + typer = np.dtype('l').type + actual = random.random_integers(typer(np.iinfo('l').max), + typer(np.iinfo('l').max)) + assert_(len(w) == 1) + assert_equal(actual, desired) + def test_random_integers_deprecated(self): with warnings.catch_warnings():