def read_random_int(nbits):
 randomdata = read_random_bits(nbits)
 value = transform.bytes2int(randomdata)
 value |= (1 << (nbits - 1))
 return value

def read_random_int ( nbits ) : randomdata = read_random_bits ( nbits ) value = transform . bytes2int ( randomdata ) value |= ( 1 << ( nbits - 1 ) ) return value
reads a random integer of approximately nbits bits .