public BigInteger (int numBits, Random rnd)

Constructs a randomly generated BigInteger, uniformly distributed over the range 0 to (2 numBits - 1), inclusive. The uniformity of the distribution assumes that a fair source of random bits is provided in rnd. Note that this constructor always constructs a non-negative BigInteger.

Parameters:
numBits    maximum bitLength of the new BigInteger.
rnd    source of randomness to be used in computing the new BigInteger.

Exceptions:
IllegalArgumentException    numBits is negative.

See also:
bitLength()