factor: simplify loop in test

This commit is contained in:
Daniel Hofstetter 2023-08-22 09:45:17 +02:00
parent 0f0f59269f
commit 1b705ae07c

View file

@ -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) => {