We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent f032b61 commit e1f835dCopy full SHA for e1f835d
rand_distr/src/hypergeometric.rs
@@ -291,8 +291,9 @@ impl Distribution<u64> for Hypergeometric {
291
initial_x: mut x,
292
} => {
293
let mut u = rng.random::<f64>();
294
+
295
+ // the paper erroneously uses `until n < p`, which doesn't make any sense
296
while u > p && x < k as i64 {
- // the paper erroneously uses `until n < p`, which doesn't make any sense
297
u -= p;
298
p *= ((n1 as i64 - x) * (k as i64 - x)) as f64;
299
p /= ((x + 1) * (n2 as i64 - k as i64 + 1 + x)) as f64;
0 commit comments