mirror of
https://github.com/uutils/coreutils
synced 2024-12-04 18:39:52 +00:00
factor: simplify loop in test
This commit is contained in:
parent
0f0f59269f
commit
1b705ae07c
1 changed files with 3 additions and 5 deletions
|
@ -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) => {
|
||||
|
|
Loading…
Reference in a new issue