code: def randomZ(maximum=None, bits=256):
      
      result = BigInt()
  
      # Select a random number smaller than the maximum.
      if maximum:
          maximum = coerceBigInt(maximum)
          librelic.bn_rand_mod(byref(result), byref(maximum))
  
      # Otherwise, select a random BigInt of the appropriate size in bits.
      else:
          librelic.bn_rand_abi(byref(result), BigInt.POSITIVE_FLAG, c_int(bits))
      
      return result
docs: Retrieve a random BigInt.
      @maximum: If specified, the value will be no larger than this modulus.
      @bits: If no maximum is specified, the value will have @bits.