public static BigInteger generateRandomPrimeGreaterThan ( BigInteger num ) { BigInteger res = BigInteger . ZERO ; while ( res . compareTo ( num ) <= 0 ) { res = BigInteger . probablePrime ( num . bitLength ( ) , RANDOM ) ; } return res ; }
Generate random probable prime guaranteed to be greater than the number specified .