Code Puzzle #2 - Generate random fake surnames
I'm talking to you, Mr. Thymmet! Step forward and be counted, Ms. Betusen! It's time for another Code Puzzle! My solution will be posted on Friday, 1/12. Get to work!
UPDATE: Read the recap here.
Task: Write a single function which generates fake but passable surnames.
- Post your solution in the comments along with 25 results.
- Names should be pronouncable and passable as real surnames. If you saw them on a business card, your reaction should at the most be an inward chuckle.
- Your solution should be capable of generating a large number of random names. (My solution generated 1.7+ million distinct names in a simple test.)
- My solution creates surnames which would make sense in the US. Feel free to write something target different ethnicities, but please let us know which you're targeting.
- Keep it simple. My solution is 33 lines and 2,700 characters, including some comments. My function takes no parameters and returns a string.
- Use whatever language you want; please specify if it's not VB.NET or C# using .NET 2.0. Yeah, I know you can probably write this in 8 characters in PowerShell, Ruby, Python, and Boo. So do it!
- Your code cannot reference any external resouces (no internet access, no file or data access, etc.).
- Your code doesn't need to worry about filtering obscenities (but please keep your obscene results to yourself).
Judging criteria:
This is a fixed contest; my solution will win first place. However, to achieve glory in this contest you must:
- Generate passable surnames
- Use concise yet readable code
- Try to be elegant, but things like magic numbers and hardcoded strings are fine by me
Sample output:
for (int i = 0; i < 50; i++)
Console.WriteLine(GenerateSurname());
Greta
Slease
Sloje
Seethoson
Sleeslo
Tethe
Heshoez
Lackesm
Sorommees
McTeame
Louwheth
Sheysset
Sakneesm
Lathet
Tosoatesm
Betusen
McTasea
Fata
Thymmet
Degha
Thateyez
Thethatea
McShatte
Tethes
(Yes, these look silly when listed together. The idea is that they shouldn't stand out on a page in the phonebook. Let's see you do better!)
References:
- Common surnames circa 1990
- English orthography on Wikipedia
- Common Surnames Worldwide on Wikipedia
No. I was working on a sample application and wanted to generate a few hundred names to demonstrate paging through data. I thought about it, and I don't believe this will help spammers. It's very easy for spammers to just use lists of actual names (such as the common surnames list in the references above). Spam filtering algorithms can't block e-mail from common surnames, or they'd be blocking most of their legitimate e-mail traffic. It would be a waste of time for spammers to bother with generating random surnames.