Skip to content

Commit

Permalink
Move comment in rand_distr/src/hypergeometric.rs
Browse files Browse the repository at this point in the history
  • Loading branch information
newpavlov committed May 8, 2024
1 parent f032b61 commit e1f835d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion rand_distr/src/hypergeometric.rs
Original file line number Diff line number Diff line change
Expand Up @@ -291,8 +291,9 @@ impl Distribution<u64> for Hypergeometric {
initial_x: mut x,
} => {
let mut u = rng.random::<f64>();

// the paper erroneously uses `until n < p`, which doesn't make any sense
while u > p && x < k as i64 {
// the paper erroneously uses `until n < p`, which doesn't make any sense
u -= p;
p *= ((n1 as i64 - x) * (k as i64 - x)) as f64;
p /= ((x + 1) * (n2 as i64 - k as i64 + 1 + x)) as f64;
Expand Down

0 comments on commit e1f835d

Please sign in to comment.