#!/usr/bin/python import time; import random; consonants = ( 'b', 'c', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'm', 'n', 'p', 'q', 'r', 's', 't', 'v', 'w', 'x', 'z' ); vowels = ('a', 'e', 'i', 'o', 'u' ); random.seed(time.time()); print "Content-type: text/html"; print; print '
This utility is for generating random character names. It uses a less-than-useful die rolling name generation algorithm that may be familiar to D&D players. Here goes:
';
for i in range(1,10):
name = '';
consonantsInRow = 0;
while 1:
val = random.randrange(1, 6);
if ((val == 6 and name.Length > 2) or consonantsInRow >= 3):
break;
elif (val == 4 or val == 5):
name += vowels[random.randrange(0, 5)];
consonantsInRow = 0;
continue;
elif (val == 1 or val == 2 or val == 3):
name += consonants[random.randrange(0, 19)];
consonantsInRow = consonantsInRow + 1;
continue;
print ' ' + name + '
';
print '
To generate a new set of names, refresh the page.
'; print '' print ''; print '';