Algorithm used by BigInteger prime generator?

John Keiser John.Keiser at
Thu Apr 22 12:14:47 PDT 1999

Quoth Per Bothner [mailto:bothner at]:
> "D'Arcy Smith" <darcy at> writes:
> > [crypto] is what [BigInteger] is was written for in the first place
> > apparently...
> I had the (unsubstantiated) impression was that it was written for
> JDBC (i.e. a needed SQL data type).  Certainly, I can't imagine
> BigDecimal being useful for crypto, but big decimal integers
> (at least 18 digits) are needed for database applications.

His assumption was probably based on this constructor:

BigInteger(int bitLength, int certainty, Random rnd)
          Constructs a randomly generated positive BigInteger that is
probably prime, with the specified bitLength.

Primes usually imply crypto.  They certainly don't imply database.

Incidentally, as long as this method creates random BigIntegers, why does it
matter what algorithm is used?  As long as the distribution is roughly the
same as JDK's, as long as it doesn't take longer, and as long as the
bitLength and certainty parameters are honored, the algorithm shouldn't
matter.  Random numbers are one area where a complete algorithm is not
necessary for a complete specification, IMHO.

--John Keiser

More information about the kaffe mailing list