public static BigInteger genPseudoPrime(int bits, int confidence, 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(confidence);
}
return result;
}