Package com.google.common.math
Enum Class LongMath.MillerRabinTester
- All Implemented Interfaces:
Serializable
,Comparable<LongMath.MillerRabinTester>
,Constable
- Enclosing class:
LongMath
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
Enum Constants -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) abstract long
mulMod
(long a, long b, long m) Returns a * b mod m.private long
powMod
(long a, long p, long m) Returns a^p mod m.(package private) abstract long
squareMod
(long a, long m) Returns a^2 mod m.(package private) static boolean
test
(long base, long n) private boolean
testWitness
(long base, long n) Returns true if n is a strong probable prime relative to the specified base.static LongMath.MillerRabinTester
Returns the enum constant of this class with the specified name.static LongMath.MillerRabinTester[]
values()
Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
SMALL
Works for inputs ≤ FLOOR_SQRT_MAX_LONG. -
LARGE
Works for all nonnegative signed longs.
-
-
Constructor Details
-
MillerRabinTester
private MillerRabinTester()
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum class has no constant with the specified nameNullPointerException
- if the argument is null
-
test
static boolean test(long base, long n) -
mulMod
abstract long mulMod(long a, long b, long m) Returns a * b mod m. -
squareMod
abstract long squareMod(long a, long m) Returns a^2 mod m. -
powMod
private long powMod(long a, long p, long m) Returns a^p mod m. -
testWitness
private boolean testWitness(long base, long n) Returns true if n is a strong probable prime relative to the specified base.
-