avt.DynamicFlashRotator.Net.RegCore.Cryptography.BigInteger.genPseudoPrime C# (CSharp) Method

genPseudoPrime() public static method

public static genPseudoPrime ( int bits, int confidence, Random rand ) : BigInteger
bits int
confidence int
rand System.Random
return BigInteger
        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;
        }