Auth.Nexus / generate-userid.py
ChandimaPrabath's picture
num user id
07c16c1
raw
history blame contribute delete
611 Bytes
import uuid
def generate_numeric_user_id(length=16):
"""
Generates a numeric user ID with the specified length.
Args:
length: The desired length of the user ID.
Returns:
A string representing the numeric user ID.
"""
# Generate a random UUID
uuid_str = str(uuid.uuid4()).replace('-', '')
# Convert the UUID to an integer
uuid_int = int(uuid_str, 16)
# Generate a numeric ID with the specified length
numeric_id = str(uuid_int)[-length:]
return numeric_id
# Generate and print a numeric user ID
user_id = generate_numeric_user_id()
print(f"Generated User ID: {user_id}")