Skip to content

Commit

Permalink
factor: simplify loop in test
Browse files Browse the repository at this point in the history
  • Loading branch information
cakebaker committed Aug 22, 2023
1 parent 0f0f592 commit 1b705ae
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 1b705ae

Please sign in to comment.