Replace random.randint() with os.urandom()