File size: 611 Bytes
07c16c1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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}")