def randbelow(exclusive_upper_bound): """Return a random int in the range [0, n).""" if exclusive_upper_bound <= 0: raise ValueError("Upper bound must be positive.") return _sysrand._randbelow(exclusive_upper_bound)
DEFAULT_ENTROPY = 32 # number of bytes to return by default
def token_bytes(nbytes=None): """Return a random byte string containing *nbytes* bytes.
If *nbytes* is ``None`` or not supplied, a reasonable default is used.