List of utility methods to do BigInteger Random
BigInteger | mod_rand(Random rand, BigInteger mod) Modular random number generator. int bit_size = mod.bitLength(); BigInteger res; do { res = new BigInteger(bit_size, rand); } while (res.bitLength() < bit_size - 4 || res.compareTo(mod) >= 0); return res; |
BigInteger | mod_rand_with_inverse(Random rand, BigInteger mod) Modular random number generator for the multiplicative subgroup. BigInteger res; do { res = mod_rand(rand, mod); } while (!coprime(res, mod)); return res; |