diff options
author | Kevin Sheppard <kevin.k.sheppard@gmail.com> | 2019-09-13 23:04:15 +0100 |
---|---|---|
committer | Kevin Sheppard <kevin.k.sheppard@gmail.com> | 2019-09-14 21:35:15 +0100 |
commit | 5e148ad95f6135382ee5adf999a38342b792ae06 (patch) | |
tree | dc3602426c41e68e32a2ffda27cbfe0b015acbeb /numpy/random/tests | |
parent | 31ffdecf07d18ed4dbb66b171cb0f998d4b190fa (diff) | |
download | numpy-5e148ad95f6135382ee5adf999a38342b792ae06.tar.gz |
BUG: Fix randint when range is 2**32
Fix randint to use 32-bit path when range is exactly 2**32
closes #14189
Diffstat (limited to 'numpy/random/tests')
-rw-r--r-- | numpy/random/tests/test_randomstate_regression.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/numpy/random/tests/test_randomstate_regression.py b/numpy/random/tests/test_randomstate_regression.py index 29870534a..ae92319c4 100644 --- a/numpy/random/tests/test_randomstate_regression.py +++ b/numpy/random/tests/test_randomstate_regression.py @@ -181,3 +181,14 @@ class TestRegression(object): assert c.dtype == np.dtype(int) c = np.random.choice(10, replace=False, size=2) assert c.dtype == np.dtype(int) + + @pytest.mark.skipif(np.iinfo('l').max < 2**32, + reason='Cannot test with 32-bit C long') + def test_randint_117(self): + # GH 14189 + random.seed(0) + expected = np.array([2357136044, 2546248239, 3071714933, 3626093760, + 2588848963, 3684848379, 2340255427, 3638918503, + 1819583497, 2678185683], dtype='int64') + actual = random.randint(2**32, size=10) + assert_array_equal(actual, expected)
\ No newline at end of file |