diff options
author | Robert Kern <robert.kern@gmail.com> | 2007-12-06 05:18:54 +0000 |
---|---|---|
committer | Robert Kern <robert.kern@gmail.com> | 2007-12-06 05:18:54 +0000 |
commit | 0a5bcc81689975874e358e3a7e8f401b8858b77f (patch) | |
tree | 03dd526617b43ad7ed06d04b73bac0abf71507ec | |
parent | 89fa0fd46c1f422af824484e19ac62fe0492842f (diff) | |
download | numpy-0a5bcc81689975874e358e3a7e8f401b8858b77f.tar.gz |
Use a correct upper bound for the inversion search in binomial distributions.
-rw-r--r-- | numpy/random/mtrand/distributions.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/numpy/random/mtrand/distributions.c b/numpy/random/mtrand/distributions.c index 43d35d81d..a7acbd91b 100644 --- a/numpy/random/mtrand/distributions.c +++ b/numpy/random/mtrand/distributions.c @@ -389,7 +389,7 @@ long rk_binomial_inversion(rk_state *state, long n, double p) state->q = q = 1.0 - p; state->r = qn = exp(n * log(q)); state->c = np = n*p; - state->m = bound = min(n, np + 10.0*sqrt(np)); + state->m = bound = min(n, np + 10.0*sqrt(np*q + 1)); } else { q = state->q; |