//*********************************************************************** // Generates a positive BigInteger that is probably prime. // Overloaded to use the isProbablePrime method with no confidence value //*********************************************************************** internal static BigInteger genPseudoPrime(int bits, Random rand) { BigInteger result = new BigInteger(); bool done = false; while (!done) { result.genRandomBits(bits, rand); result.data[0] |= 0x01; // make it odd // prime test done = result.isProbablePrime(); } return result; }