11/*
22 * java-math-library is a Java library focused on number theory, but not necessarily limited to it. It is based on the PSIQS 4.0 factoring project.
3- * Copyright (C) 2018-2024 Tilman Neumann - tilman.neumann@web.de
3+ * Copyright (C) 2018-2026 Tilman Neumann - tilman.neumann@web.de
44 *
55 * This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License
66 * as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.
2020import org .apache .logging .log4j .Logger ;
2121import org .apache .logging .log4j .LogManager ;
2222
23- import de .tilman_neumann .jml .primes .probable .BPSWTest ;
23+ import de .tilman_neumann .jml .primes .probable .PrPTest ;
2424import de .tilman_neumann .jml .random .Rng ;
2525
2626import static de .tilman_neumann .jml .base .BigIntConstants .*;
@@ -38,7 +38,7 @@ public class TestsetGenerator {
3838 private static final boolean DEBUG = false ;
3939 private static final boolean DUMP_DATA_TO_FILE = false ;
4040
41- private static final BPSWTest bpsw = new BPSWTest ();
41+ private static final PrPTest prpTest = new PrPTest ();
4242 private static final Rng RNG = new Rng ();
4343
4444 /**
@@ -61,7 +61,7 @@ public static BigInteger[] generate(int N_count, int bits, TestNumberNature mode
6161 if (bits <3 ) throw new IllegalArgumentException ("There are no composites with " + bits + " bits." );
6262 for (int i =0 ; i <N_count ; ) {
6363 BigInteger N = new BigInteger (bits , RNG );
64- if (N .bitLength ()==bits && !bpsw .isProbablePrime (N )) {
64+ if (N .bitLength ()==bits && !prpTest .isProbablePrime (N )) {
6565 NArray [i ++] = N ;
6666 // TODO write to data file
6767 }
@@ -72,7 +72,7 @@ public static BigInteger[] generate(int N_count, int bits, TestNumberNature mode
7272 if (bits <4 ) throw new IllegalArgumentException ("There are no odd composites with " + bits + " bits." );
7373 for (int i =0 ; i <N_count ; ) {
7474 BigInteger N = new BigInteger (bits , RNG ).or (I_1 ); // odd random number
75- if (N .bitLength ()==bits && !bpsw .isProbablePrime (N )) {
75+ if (N .bitLength ()==bits && !prpTest .isProbablePrime (N )) {
7676 NArray [i ++] = N ;
7777 // TODO write to data file
7878 }
@@ -88,11 +88,11 @@ public static BigInteger[] generate(int N_count, int bits, TestNumberNature mode
8888 // of randomness while still being reasonably fast for large bit sizes.
8989 int n1bits = RNG .nextInt (minBits , maxBits );
9090 BigInteger n1 = new BigInteger (n1bits , RNG );
91- n1 = bpsw .nextProbablePrime (n1 );
91+ n1 = prpTest .nextProbablePrime (n1 );
9292 if (n1 .bitLength ()<minBits ) continue ;
9393
9494 BigInteger N = new BigInteger (bits , RNG );
95- BigInteger n2 = bpsw .nextProbablePrime (N .divide (n1 ));
95+ BigInteger n2 = prpTest .nextProbablePrime (N .divide (n1 ));
9696 N = n1 .multiply (n2 );
9797 if (N .bitLength () != bits ) continue ;
9898 if (n1 .pow (3 ).compareTo (N ) < 0 ) continue ;
@@ -109,11 +109,11 @@ public static BigInteger[] generate(int N_count, int bits, TestNumberNature mode
109109 // generate random N with 2 prime factors
110110 BigInteger n1 = new BigInteger (minBits , RNG );
111111 n1 = n1 .setBit (minBits -1 );
112- n1 = bpsw .nextProbablePrime (n1 );
112+ n1 = prpTest .nextProbablePrime (n1 );
113113 int n2bits = bits -n1 .bitLength ();
114114 BigInteger n2 = new BigInteger (n2bits , RNG );
115115 n2 = n2 .setBit (n2bits -1 );
116- n2 = bpsw .nextProbablePrime (n2 );
116+ n2 = prpTest .nextProbablePrime (n2 );
117117 BigInteger N = n1 .multiply (n2 );
118118 if (DEBUG ) LOG .debug ("bits=" + bits + ", N1Bits=" + n1 .bitLength () + ", N2Bits=" + n2 .bitLength ());
119119
0 commit comments