Skip to content

Instantly share code, notes, and snippets.

@tiagocoutinho
Last active April 5, 2024 04:45
Show Gist options
  • Save tiagocoutinho/4ee5c9be94ca990eaa1f82d8832f157c to your computer and use it in GitHub Desktop.
Save tiagocoutinho/4ee5c9be94ca990eaa1f82d8832f157c to your computer and use it in GitHub Desktop.
Generate random name in python
import random
import string
ascii_alphanumeric = string.ascii_letters + string.digits
def random_name(min_length=32, max_length=32):
if not (k := random.randint(min_length, max_length)):
return ""
first = random.choice(string.ascii_letters)
return first + "".join(random.choices(ascii_alphanumeric, k=k-1))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment