summaryrefslogtreecommitdiff
path: root/numpy
diff options
context:
space:
mode:
authorRobert Kern <robert.kern@gmail.com>2007-12-03 06:39:46 +0000
committerRobert Kern <robert.kern@gmail.com>2007-12-03 06:39:46 +0000
commit0f4730e74c87e50c6ccc5b072ea733d9a3fe96f4 (patch)
tree4f370e79738f6a011a0ae9363af105cc7352b4ba /numpy
parent37689e0dd3f0e76f0c043784c961d2918dd175b5 (diff)
downloadnumpy-0f4730e74c87e50c6ccc5b072ea733d9a3fe96f4.tar.gz
BUG: fix incorrect ordering of the 'good' and 'bad' objects in the hypergeometric distribution.
Diffstat (limited to 'numpy')
-rw-r--r--numpy/random/mtrand/distributions.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/numpy/random/mtrand/distributions.c b/numpy/random/mtrand/distributions.c
index bbf02a061..43d35d81d 100644
--- a/numpy/random/mtrand/distributions.c
+++ b/numpy/random/mtrand/distributions.c
@@ -742,7 +742,7 @@ long rk_hypergeometric_hyp(rk_state *state, long good, long bad, long sample)
if (K == 0) break;
}
Z = (long)(d2 - Y);
- if (bad > good) Z = sample - Z;
+ if (good > bad) Z = sample - Z;
return Z;
}
@@ -795,7 +795,7 @@ long rk_hypergeometric_hrua(rk_state *state, long good, long bad, long sample)
}
/* this is a correction to HRUA* by Ivan Frohne in rv.py */
- if (bad > good) Z = m - Z;
+ if (good > bad) Z = m - Z;
/* another fix from rv.py to allow sample to exceed popsize/2 */
if (m < sample) Z = bad - Z;