1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-08-01 05:27:45 +00:00

tests: update factor Distribution<Factors> sample to take range

This commit is contained in:
Greg Guthe 2022-01-18 08:47:39 -05:00
parent 1e0dc6c278
commit a342df03f0

View file

@ -258,7 +258,7 @@ impl Distribution<Factors> for Standard {
// See Generating Random Factored Numbers, Easily, J. Cryptology (2003)
'attempt: loop {
while n > 1 {
n = rng.gen_range(1, n);
n = rng.gen_range(1..n);
if miller_rabin::is_prime(n) {
if let Some(h) = g.checked_mul(n) {
f.push(n);