This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
Patch: java.math.BigInteger
- From: Jerry Quinn <jlquinn at optonline dot net>
- To: java-patches at gcc dot gnu dot org
- Date: Sun, 06 Apr 2003 11:21:35 -0400
- Subject: Patch: java.math.BigInteger
This is the other java.math function that appears to be missing in the
comparison against jdk 1.4.
2003-04-06 Jerry Quinn <jlquinn at optonline dot net>
* java/math/BigInteger.java (BigInteger::probablePrime): New.
*** BigInteger.java.~1.18.34.4.~ Tue Feb 18 13:15:26 2003
--- BigInteger.java Sun Apr 6 11:20:32 2003
***************
*** 223,228 ****
--- 223,244 ----
}
}
+ /** Return a BigInteger that is bitLength bits long with a
+ * probability < 2^-100 of being composite.
+ *
+ * Throws ArithmeticException if bitLength < 2.
+ *
+ * @param bitLength length in bits of resulting number
+ * @param rnd random number generator to use
+ */
+ public static BigInteger probablePrime(int bitLength, Random rnd)
+ {
+ if (bitLength < 2)
+ throw new ArithmeticException();
+
+ return new BigInteger(bitLength, 100, rnd);
+ }
+
/** Return a (possibly-shared) BigInteger with a given long value. */
public static BigInteger valueOf(long val)
{