Random name generator

I decided to write this post about my random name generator because I had a hard time finding code or algorithms for anything like this and I believe that others will find it usefull.

I've spent a lot of time perfecting my random name generator. The first thing that comes to mind when you're trying to make a name generator is alternating consonants and vowels. I tried that but I wasn't satisfied at all. Most of the results you end up are impossible to pronounce.

And so, I wondered, how to make the results pronouncable? I wanted to find out which letter could follow which. I wrote a small program to analyze a bunch of random texts and tell me which letters were found following which. I used the results in a new generator and it was a big improvement over the first one. I removed some letter combinations that don't work in my opinion but still the generated names weren't what I wanted to get.

So my next observation was that some letter combinations are possible in the beggining of words, some in the middle and some in the end. I wrote another simple tool to analyze a big bunch of text and this time produce three tables for the relations between letters, which you can find below. I ended up changing the tables quite a bit as I was testing, removing combinations that usually don't work.

They way I currently generate the name is as follows: the first letter is random, the second is from the ones that can follow the first. If neither of them vas a vowel, I add one while making sure it can follow the previous letter. The next letter is from the table for the middle of the word. If it wasn't a vowel I add one the same way as before. The second to last letter is from the middle table as well while the last one if from the third table. Also I throw out any name that ahs three vowels in a row (this wan't in the last demo I posted but will be in the next). I hope it makes sense, check out the tables below and also the link to my implementation in C#. I hope this was useful! Here you can download my implementation. Also if anyone happen to wonder how to set up their blogspot blog to display code I recommend reading here. Looking forward to your comments!

Posted by FiLkAtA | at 4:06 PM

0 comments:

Post a Comment