Java Utililty Methods BigInteger Random

List of utility methods to do BigInteger Random

Description

The list of methods to do BigInteger Random are organized into topic(s).

Method

BigIntegermod_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;
BigIntegermod_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;