/* Program: The stange FANTASY NAME GENERATOR Author: lucifer@infernal.demon.co.uk copywrite (c) 1995, by lucifer@infernal.demon.co.uk This C code is public domain and may be freely distributed, provided credit is given the author. About 1 in 4 names is actually reasonable, 1 in 10 is quite good. They can sound Japanese, Mayan, Roman, Celtic, English or Complete Gibberish! Usage: namegen [number_of_names] */ #include #include #include char *soft_group[]={ "a", "e", "i", "o", "u", "y", "ee", "ai", "ae", "ea", "ai", "ya", "io", "oo", "ui", "ou", "a", "e", "i", "o"}; char *hard_group[]={ "h","th","sh","cl","r", "qu","m","j","g","b", "lh","x","sc","p","t", "l","n","f","d","br", "pr","sp","cr","sl","tr", "fr","st","gr","s","pl", "ch","fr","tch","ph","tz", "vr","rr","ss","tt","ll", "pp","nm","mn","j","w", "dl","mr","rt","lp","bl"}; char *pre_group[]={ "h","th","sh","cl","r", "qu","m","j","g","b", "lh","x","sc","p","t", "l","n","f","d","br", "pr","sp","cr","sl","tr", "fr","st","gr","s","pl"}; main(int argc, char *argv[]) { int num_groups, x, num_runs; srand(clock()); /* I want a proper random number.. */ if (argc >0) sscanf(argv[1], "%d", &num_runs); else num_runs=1; for(;num_runs>0;num_runs--) /* How many names..*/ { /* Get the length */ num_groups = d(3)+d(3); /* Prefix */ x = d(50); if(x <=30) { printf("%s", pre_group[x-1]); } else { num_groups++; } while (num_groups>0) { if(num_groups>0) /* soft word group (if statement not needed) */ { printf("%s", soft_group[d(20)-1]); num_groups--; } if(num_groups>0) /* hard word group */ { printf("%s", hard_group[d(50)-1]); num_groups--; } } /* end */ printf("\n"); } } int d(int type) { return((rand() % type)+1); }