Last active
April 5, 2024 04:45
-
-
Save tiagocoutinho/4ee5c9be94ca990eaa1f82d8832f157c to your computer and use it in GitHub Desktop.
Generate random name in python
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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