8 lines
257 B
Python
8 lines
257 B
Python
# app/utils/short_code.py
|
|
import string
|
|
import random
|
|
|
|
def generate_short_code(length: int = 6) -> str:
|
|
"""Generate a random alphanumeric short code."""
|
|
chars = string.ascii_letters + string.digits
|
|
return ''.join(random.choices(chars, k=length)) |