private static BigInteger generateRandomInteger(BigInteger n,SecureRandom random){
  return new BigInteger(n.bitLength() - 1,random);
}

private static BigInteger generateRandomInteger ( BigInteger n , SecureRandom random ) { return new BigInteger ( n . bitLength ( ) - 1 , random ) ; }
generates random integer such , than its bit length is less than that of n
