def randombytes(n):
    """Return n random bytes."""
    # Use /dev/urandom if it is available.  Fall back to random module
    # if not.  It might be worthwhile to extend this function to use
    # other platform-specific mechanisms for getting random bytes.
    if os.path.exists("/dev/urandom"):
        f = open("/dev/urandom")
        s = f.read(n)
        f.close()
        return s
    else:
        L = [chr(random.randrange(0, 256)) for i in range(n)]
        return "".join(L)
def randombytes ( n ) : if os . path . exists ( "/dev/urandom" ) : f = open ( "/dev/urandom" ) s = f . read ( n ) f . close ( ) return s else : L = [ chr ( random . randrange ( 0 , 256 ) ) for i in range ( n ) ] return "" . join ( L )
Return n random bytes.