Drawing a blank with respect to what to name your daughter? Don't like any of the usual names? Try the following C program. It creates names by combining the elements of the usual suspects.
<attachment name="makename.c">
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h> /* for srand(time(NULL)) */
#define MAX_ELEM_LEN 16
#define NUM_ELEMENTS 167
#define NUM_ENDINGS 10
const char elements[NUM_ELEMENTS][MAX_ELEM_LEN] =
{
"be", "bell", "bern", "berth", "beth",
"beul", "bonni", "bridgi", "brunild", "carinn",
"cat", "cecili", "chlo", "clar", "claudi",
"col", "colen", "consuel", "cor", "corneli",
"cosett", "cyndi", "dan", "dari", "darl",
"debor", "del", "dolor", "dor", "dorothe",
"dulci", "edn", "ell", "ev", "fann",
"fausti", "feli", "ferd", "fifi", "flor",
"franci", "fred", "genev", "georgi", "gild",
"gin", "giov", "giuli", "glori", "gret",
"griseld", "gunill", "gwend", "helg", "henri",
"hephzib", "herth", "honori", "horati", "huld",
"hermi", "hest", "is", "jeann", "jemim",
"jessic", "jo", "kristi", "laur", "le",
"len", "lind", "lis", "livi", "lol",
"lon", "lor", "lorn", "louis", "luci",
"magd", "mari", "mir", "mil", "mind",
"mon", "monic", "nad", "ness", "nicol",
"non", "nor", "norm", "ori", "priscill",
"penel", "polli", "raciel", "rebecc", "regin",
"rhod", "robert", "ros", "sand", "shirl",
"sib", "son", "stell", "steph", "sus",
"sylvi", "tar", "tess", "tiff", "trici",
"ver", "vinni", "viv", "wilm", "yol",
"abig", "ad", "adri", "agard", "agath",
"aid", "elaid", "albert", "alethe", "alexi",
"alfred", "alm", "alt", "althe", "alv",
"alvir", "amand", "ameli", "anc", "and",
"andre", "angel", "ann", "anthe", "antoni",
"aren", "arb", "arci", "aric", "arili",
"arit", "arlen", "arlott", "aronic", "arri",
"arth", "ashli", "astasi", "athsheb", "atild",
"atri", "audre", "august", "aureli", "auror",
"avel", "averli"
};
const char endings[NUM_ENDINGS][MAX_ELEM_LEN] =
{
"a", "abel", "alison", "amy", "chen",
"ie", "ietty", "icia", "ietta", "ina"
};
int main(const int argc, const char **argv)
{
int seed = -1;
char strout[3 * MAX_ELEM_LEN] = {0};
int elemno_first, elemno_second, elemno_ending;
if(argc >= 2)
{
if(argv[1][0] == 'r')
seed = time(NULL) % (NUM_ELEMENTS * (NUM_ELEMENTS - 1) * NUM_ENDINGS);
else
seed = atoi(argv[1]);
}
if(seed < 0)
{
fputs("usage: makename 12345 or, for a random name, makename r\n", stderr);
return 255;
}
/* pick the elements */
elemno_ending = seed % NUM_ENDINGS;
seed /= NUM_ENDINGS;
elemno_second = seed % (NUM_ELEMENTS - 1);
seed /= (NUM_ELEMENTS - 1);
elemno_first = seed % NUM_ELEMENTS;
seed /= NUM_ELEMENTS;
if(elemno_second >= elemno_first)
elemno_second++;
/* assemble them */
strcpy(strout, elements[elemno_first]);
/* separate two consecutive consonants with a vowel */
if(strchr("aeiou", elements[elemno_second][0]) == NULL)
strcat(strout, "a");
strcat(strout, elements[elemno_second]);
if(strout[strlen(strout) - 1] == endings[elemno_ending][0]) /* if the last
* letter in the second element matches the first letter in the ending */
strout[strlen(strout) - 1] = 0; /* drop it */
strcat(strout, endings[elemno_ending]);
/* put it into stdout */
puts(strout);
return 0;
}
</attachment>
This is actually the second version of this program. The first was in QBasic and was much uglier because I failed to see the symmetry of the problem because I wrote it quickly right after seeing a film on TCM with a character named Annamanda. The main reason I wrote this in C was because I didn't know Perl. But if you're going to use one of the Perl versions listed below, use the one by m_turner, who wrote: "I wrote the 'right' perl in response to the wrong perl. It should be fully explained, if you have any questions ask."