Skip to content

Instantly share code, notes, and snippets.

@Josephchinedu
Created August 24, 2022 15:51
Show Gist options
  • Save Josephchinedu/3757d78425ef4a101d04421f84e3993e to your computer and use it in GitHub Desktop.
Save Josephchinedu/3757d78425ef4a101d04421f84e3993e to your computer and use it in GitHub Desktop.
Generate random name
import string
import random
def generate_random_name(length):
VOWELS = "aeiou"
CONSONANTS = "".join(set(string.ascii_lowercase) - set(VOWELS))
word = ""
for i in range(length):
if i % 2 == 0:
word += random.choice(CONSONANTS)
else:
word += random.choice(VOWELS)
return word
if __name__ == "__main__":
fullname = []
for i in range(3):
fullname.append(generate_random_name(6))
fullname = ' '.join(fullname)
print("full name: ", fullname)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment