Skip to content

Commit

Permalink
Merge pull request uutils#5192 from cakebaker/factor_refactor_loop
Browse files Browse the repository at this point in the history
factor: simplify loop in test
  • Loading branch information
sylvestre authored Aug 22, 2023
2 parents 0f0f592 + 1b705ae commit f1ec8e6
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions tests/by-util/test_factor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,14 +163,12 @@ fn test_random() {
let mut factors = Vec::new();
while product < min {
// log distribution---higher probability for lower numbers
let factor;
loop {
let factor = loop {
let next = rng.gen_range(0_f64..log_num_primes).exp2().floor() as usize;
if next < NUM_PRIMES {
factor = primes[next];
break;
break primes[next];
}
}
};

match product.checked_mul(factor) {
Some(p) => {
Expand Down

0 comments on commit f1ec8e6

Please sign in to comment.