Class MillerRabinTest
java.lang.Object
de.tilman_neumann.jml.primes.probable.MillerRabinTest
public class MillerRabinTest
extends java.lang.Object
Miller-Rabin probable prime test.
-
Constructor Summary
Constructors Constructor Description MillerRabinTest() -
Method Summary
Modifier and Type Method Description booleanisProbablePrime(java.math.BigInteger N, int numberOfRounds)Perform up to numberOfRounds Miller-Rabin tests with random bases.booleantestBases(java.math.BigInteger N, java.math.BigInteger[] bases)Perform Miller-Rabin test of N to several bases.booleantestSingleBase(java.math.BigInteger N, java.math.BigInteger x)Perform a single Miller-Rabin test of N to base x.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
MillerRabinTest
public MillerRabinTest()
-
-
Method Details
-
isProbablePrime
public boolean isProbablePrime(java.math.BigInteger N, int numberOfRounds)Perform up to numberOfRounds Miller-Rabin tests with random bases.- Parameters:
N-numberOfRounds-- Returns:
- true if N passes all tests, false if N is composite
-
testBases
public boolean testBases(java.math.BigInteger N, java.math.BigInteger[] bases)Perform Miller-Rabin test of N to several bases.- Parameters:
N-bases-- Returns:
- true if N is probable prime, false if N is composite
-
testSingleBase
public boolean testSingleBase(java.math.BigInteger N, java.math.BigInteger x)Perform a single Miller-Rabin test of N to base x.- Parameters:
N-x- the base- Returns:
- true if N is probable prime, false if N is composite
-