Skip to content

Instantly share code, notes, and snippets.

@ojii
Created October 18, 2012 09:30
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ojii/3910708 to your computer and use it in GitHub Desktop.
Save ojii/3910708 to your computer and use it in GitHub Desktop.
Simple random name generator
from random import choice
import sys
SYLLABLES = [
'a', 'e', 'i', 'o', 'u',
'ka', 'ke', 'ki', 'ko', 'ku',
'ga', 'ge', 'gi', 'go', 'gu',
'sa', 'se', 'shi', 'so', 'su',
'ja', 'je' ,'ji', 'jo', 'ju',
'za', 'ze', 'chi', 'zo', 'zu',
'ta', 'te', 'chi', 'to', 'tsu',
'da', 'de', 'do',
'na', 'ne', 'ni', 'no', 'nu',
'ha', 'he', 'hi', 'ho', 'hu',
'ba', 'be', 'bi', 'bo', 'bu',
'pa', 'pe', 'pi', 'po', 'pu',
'ma', 'me', 'mi', 'mo', 'mu',
'ya', 'ye', 'yu',
'ra', 're', 'ri', 'ro', 'ru',
'wa', 'n',
]
def gen(num):
return ''.join(choice(SYLLABLES) for _ in range(num))
if __name__ == '__main__':
if len(sys.argv) > 1:
try:
num = int(sys.argv[1])
except ValueError:
num = 4
else:
num = 4
print gen(num)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment