Skip to content

Instantly share code, notes, and snippets.

@noxan
Last active December 27, 2023 06:57
Show Gist options
  • Star 10 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save noxan/5845351 to your computer and use it in GitHub Desktop.
Save noxan/5845351 to your computer and use it in GitHub Desktop.
A simple python script to generate random names.
#!/usr/bin/python3
import random
import string
import sys
VOWELS = "aeiou"
CONSONANTS = "".join(set(string.ascii_lowercase) - set(VOWELS))
def generate_word(length):
word = ""
for i in range(length):
if i % 2 == 0:
word += random.choice(CONSONANTS)
else:
word += random.choice(VOWELS)
return word
if __name__ == "__main__":
try:
count = int(sys.argv[1])
except:
count = 5
try:
length = int(sys.argv[2])
except:
length = 6
for i in range(count):
print(generate_word(length))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment