diff options
author | Kevin Sheppard <kevin.k.sheppard@gmail.com> | 2021-02-26 13:04:38 +0000 |
---|---|---|
committer | Kevin Sheppard <kevin.k.sheppard@gmail.com> | 2021-02-26 14:50:28 +0000 |
commit | 79c30300390c267bacb5297f36c1e9605bca8f2c (patch) | |
tree | 67418bf7313e8cc3165944ef2811ca2c9c4f5efc /numpy/random/tests/test_randomstate.py | |
parent | 5fa800a32341f24ecc178eb754dc91c9b5d0db2c (diff) | |
download | numpy-79c30300390c267bacb5297f36c1e9605bca8f2c.tar.gz |
BUG: Prevent RandomState from changing
Apply vonmises fix only to Generator
Add tests for correctness
closes #17378
closes #17275
Diffstat (limited to 'numpy/random/tests/test_randomstate.py')
-rw-r--r-- | numpy/random/tests/test_randomstate.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/numpy/random/tests/test_randomstate.py b/numpy/random/tests/test_randomstate.py index 7f5f08050..b16275b70 100644 --- a/numpy/random/tests/test_randomstate.py +++ b/numpy/random/tests/test_randomstate.py @@ -1238,6 +1238,15 @@ class TestRandomDist: r = random.vonmises(mu=0., kappa=1.1e-8, size=10**6) assert_(np.isfinite(r).all()) + def test_vonmises_large(self): + # guard against changes in RandomState when Generator is fixed + random.seed(self.seed) + actual = random.vonmises(mu=0., kappa=1e7, size=3) + desired = np.array([4.634253748521111e-04, + 3.558873596114509e-04, + -2.337119622577433e-04]) + assert_array_almost_equal(actual, desired, decimal=8) + def test_vonmises_nan(self): random.seed(self.seed) r = random.vonmises(mu=0., kappa=np.nan) |