Skip to content

Commit 9adceb4

Browse files
committed
factor: rename input parameter
Closes: #5883
1 parent 6e09cba commit 9adceb4

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

src/uu/factor/src/rho.rs

+8-9
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,14 @@ use std::cmp::{max, min};
1010

1111
use crate::numeric::*;
1212

13-
pub(crate) fn find_divisor<A: Arithmetic>(n: A) -> u64 {
14-
#![allow(clippy::many_single_char_names)]
13+
pub(crate) fn find_divisor<A: Arithmetic>(input: A) -> u64 {
1514
let mut rand = {
16-
let range = Uniform::new(1, n.modulus());
15+
let range = Uniform::new(1, input.modulus());
1716
let mut rng = SmallRng::from_rng(&mut thread_rng()).unwrap();
18-
move || n.to_mod(range.sample(&mut rng))
17+
move || input.to_mod(range.sample(&mut rng))
1918
};
2019

21-
let quadratic = |a, b| move |x| n.add(n.mul(a, n.mul(x, x)), b);
20+
let quadratic = |a, b| move |x| input.add(input.mul(a, input.mul(x, x)), b);
2221

2322
loop {
2423
let f = quadratic(rand(), rand());
@@ -29,11 +28,11 @@ pub(crate) fn find_divisor<A: Arithmetic>(n: A) -> u64 {
2928
x = f(x);
3029
y = f(f(y));
3130
let d = {
32-
let _x = n.to_u64(x);
33-
let _y = n.to_u64(y);
34-
gcd(n.modulus(), max(_x, _y) - min(_x, _y))
31+
let _x = input.to_u64(x);
32+
let _y = input.to_u64(y);
33+
gcd(input.modulus(), max(_x, _y) - min(_x, _y))
3534
};
36-
if d == n.modulus() {
35+
if d == input.modulus() {
3736
// Failure, retry with a different quadratic
3837
break;
3938
} else if d > 1 {

0 commit comments

Comments
 (0)