Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion Lib/uuid.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@
"""

import os
import platform
import random
import sys

from enum import Enum, _simple_enum
Expand Down Expand Up @@ -713,7 +715,7 @@ def uuid3(namespace, name):

def uuid4():
"""Generate a random UUID."""
return UUID(bytes=os.urandom(16), version=4)
return UUID(int=random.getrandbits(128), version=4)

def uuid5(namespace, name):
"""Generate a UUID from the SHA-1 hash of a namespace UUID and a name."""
Expand Down