Skip to content

Commit 5f8f651

Browse files
committed
minor performance improvement +++ comment on Xorshf64
1 parent 1dd44be commit 5f8f651

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/main/java/de/tilman_neumann/jml/factor/pollardRho/PollardRhoBrentMontgomery32.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
import de.tilman_neumann.jml.factor.FactorAlgorithm;
2222
import de.tilman_neumann.jml.gcd.Gcd31;
23-
import de.tilman_neumann.jml.random.SpRand32;
23+
import de.tilman_neumann.jml.random.Xorshf32;
2424
import de.tilman_neumann.util.Ensure;
2525

2626
/**
@@ -47,7 +47,7 @@ public class PollardRhoBrentMontgomery32 extends FactorAlgorithm {
4747
private static final Logger LOG = LogManager.getLogger(PollardRhoBrentMontgomery32.class);
4848
private static final boolean DEBUG = false;
4949

50-
private static final SpRand32 RNG = new SpRand32();
50+
private static final Xorshf32 RNG = new Xorshf32(); // looks slightly faster than SpRand32 here
5151

5252
// The reducer R is 2^32, but the only constant still required is the half of it.
5353
private static final int R_HALF = 1 << 31;

src/main/java/de/tilman_neumann/jml/random/Xorshf64.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@
1818
/**
1919
* <strong>Experimental</strong> 64 bit random number generator computing longs from three consecutive 32 bit random numbers.
2020
*
21+
* It is fast, but the quality of the generated numbers seems to be insufficient to improve the performance of
22+
* factoring algorithms like PollardRhoBrentMontgomery64.
23+
*
2124
* @author Tilman Neumann
2225
*/
2326
public class Xorshf64 {

0 commit comments

Comments
 (0)