def read_random_bits(nbits):
 (nbytes, rbits) = divmod(nbits, 8)
 randomdata = os.urandom(nbytes)
 if (rbits > 0):
  randomvalue = ord(os.urandom(1))
  randomvalue >>= (8 - rbits)
  randomdata = (byte(randomvalue) + randomdata)
 return randomdata

def read_random_bits ( nbits ) : ( nbytes , rbits ) = divmod ( nbits , 8 ) randomdata = os . urandom ( nbytes ) if ( rbits > 0 ) : randomvalue = ord ( os . urandom ( 1 ) ) randomvalue >>= ( 8 - rbits ) randomdata = ( byte ( randomvalue ) + randomdata ) return randomdata
reads nbits random bits .