Patch: java.math.BigInteger (take 2)

Jerry Quinn jlquinn@optonline.net
Sun Apr 6 18:07:00 GMT 2003


Michael Koch writes:
 > -----BEGIN PGP SIGNED MESSAGE-----
 > Hash: SHA1
 > 
 > Hi Jerry,
 > 
 > Am Sonntag, 6. April 2003 17:28 schrieb Jerry Quinn:
 > ...
 > > +   /** Return a BigInteger that is bitLength bits long with a
 > > +    *  probability < 2^-100 of being composite.
 > ...
 > 
 > This should look as follows according to our coding style:
 > ...
 > > +   /**
 > > +    * Return a BigInteger that is bitLength bits long with a
 > > +    * probability < 2^-100 of being composite.
 > ...

Here's the patch with the comment fixed. BTW, mail directly to you (by
accident) failed from my account.

Jerry Quinn



*** BigInteger.java.~1.18.34.4.~	Tue Feb 18 13:15:26 2003
--- BigInteger.java	Sun Apr  6 14:04:33 2003
***************
*** 223,228 ****
--- 223,245 ----
        }
    }
  
+   /** 
+    *  Return a BigInteger that is bitLength bits long with a
+    *  probability < 2^-100 of being composite.
+    *
+    *  @param bitLength length in bits of resulting number
+    *  @param rnd random number generator to use
+    *  @throws ArithmeticException if bitLength < 2
+    *  @since 1.4
+    */
+   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)
    {



More information about the Java-patches mailing list