mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-08-01 21:47:46 +00:00
tests: update factor Distribution<Factors> sample to take range
This commit is contained in:
parent
1e0dc6c278
commit
a342df03f0
1 changed files with 1 additions and 1 deletions
|
@ -258,7 +258,7 @@ impl Distribution<Factors> for Standard {
|
||||||
// See Generating Random Factored Numbers, Easily, J. Cryptology (2003)
|
// See Generating Random Factored Numbers, Easily, J. Cryptology (2003)
|
||||||
'attempt: loop {
|
'attempt: loop {
|
||||||
while n > 1 {
|
while n > 1 {
|
||||||
n = rng.gen_range(1, n);
|
n = rng.gen_range(1..n);
|
||||||
if miller_rabin::is_prime(n) {
|
if miller_rabin::is_prime(n) {
|
||||||
if let Some(h) = g.checked_mul(n) {
|
if let Some(h) = g.checked_mul(n) {
|
||||||
f.push(n);
|
f.push(n);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue