Class MillerRabinTest
- java.lang.Object
-
- de.tilman_neumann.jml.primes.probable.MillerRabinTest
-
public class MillerRabinTest extends Object
Miller-Rabin probable prime test.- Author:
- Tilman Neumann
-
-
Constructor Summary
Constructors Constructor Description MillerRabinTest()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
isProbablePrime(BigInteger N, int numberOfRounds)
Perform up to numberOfRounds Miller-Rabin tests with random bases.boolean
testBases(BigInteger N, BigInteger[] bases)
Perform Miller-Rabin test of N to several bases.boolean
testSingleBase(BigInteger N, BigInteger x)
Perform a single Miller-Rabin test of N to base x.
-
-
-
Method Detail
-
isProbablePrime
public boolean isProbablePrime(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(BigInteger N, 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(BigInteger N, 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
-
-