def randrange(order, entropy=None):
 if (entropy is None):
  entropy = os.urandom
 assert (order > 1)
 bytes = orderlen(order)
 dont_try_forever = 10000
 while (dont_try_forever > 0):
  dont_try_forever -= 1
  candidate = (string_to_number(entropy(bytes)) + 1)
  if (1 <= candidate < order):
   return candidate
  continue
 raise RuntimeError(('randrange() tried hard but gave up, either something is very wrong or you got realllly unlucky. Order was %x' % order))

def randrange ( order , entropy = None ) : if ( entropy is None ) : entropy = os . urandom assert ( order > 1 ) bytes = orderlen ( order ) dont_try_forever = 10000 while ( dont_try_forever > 0 ) : dont_try_forever -= 1 candidate = ( string_to_number ( entropy ( bytes ) ) + 1 ) if ( 1 <= candidate < order ) : return candidate continue raise RuntimeError ( ( 'randrange() tried hard but gave up, either something is very wrong or you got realllly unlucky. Order was %x' % order ) )
return a random integer k such that 1 <= k < order .