diff options
author | Matti Picus <matti.picus@gmail.com> | 2018-10-12 11:32:44 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-12 11:32:44 +0300 |
commit | 0a113ed38dd538983a00c0ff5d87a56df1b93867 (patch) | |
tree | 08f5c19d3e9b09099c963eb035cf1899da9ca544 /numpy | |
parent | c8007603bf44a93726191d0241db8c50e9c31de8 (diff) | |
parent | ea11a48cb670ee49a1a7a523133898bc7a644ed1 (diff) | |
download | numpy-0a113ed38dd538983a00c0ff5d87a56df1b93867.tar.gz |
Merge pull request #11613 from moshelooks/patch-2
BUG: have geometric() raise ValueError on p=0
Diffstat (limited to 'numpy')
-rw-r--r-- | numpy/random/mtrand/mtrand.pyx | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/numpy/random/mtrand/mtrand.pyx b/numpy/random/mtrand/mtrand.pyx index 80585bda4..6b054a20f 100644 --- a/numpy/random/mtrand/mtrand.pyx +++ b/numpy/random/mtrand/mtrand.pyx @@ -4143,15 +4143,15 @@ cdef class RandomState: if op.shape == (): fp = PyFloat_AsDouble(p) - if fp < 0.0: - raise ValueError("p < 0.0") + if fp <= 0.0: + raise ValueError("p <= 0.0") if fp > 1.0: raise ValueError("p > 1.0") return discd_array_sc(self.internal_state, rk_geometric, size, fp, self.lock) - if np.any(np.less(op, 0.0)): - raise ValueError("p < 0.0") + if np.any(np.less_equal(op, 0.0)): + raise ValueError("p <= 0.0") if np.any(np.greater(op, 1.0)): raise ValueError("p > 1.0") return discd_array(self.internal_state, rk_geometric, size, op, |