Name Generation Algorithm

I spent today coding a name generation algorithm.

It combines commonly found syllables (and syllable pairs) in names to get a realistic output.

[code]syl = {“liz”,“beth”,“char”,“lie”,“rie”,“tri”,“von”,“do”,“wal”,“fra”,“mer”,“sha”,“ru”,“by”,“al”,“ex”,“ob”,“es”,“elda”,“cher”,“mo”,“mart”,“in”,“dy”,“can”,“an”,“kev”,“hin”,“du”,“fred”,“geof”,“rey”,“ney”,“aul”,“grim”,“grin”,“grif”,“on”,“pil”,“val”,“ray”,“ar”,“car”,“mel”,“dom”,“dor”,“nic”,“nik”,“las”,“o”,“ow”,“frey”,“un”,“roy”,“esh”,“flor”,“ence”,“encia”,“lor”,“ju”,“jen”,“jo”,“lia”,“rin”,“bal”,“rof”,“dof”,“ing”,“red”,“rus”,“bus”,“les”,“ful”,“nie”,“ska”,“fa”,“li”,“kra”,“kov”,“vin”,“sky”,“ski”,“don”,“cia”,“nick”,“rick”,“leo”,“thor”,“na”,}

function GenerateName(names)
local namest = {}
for n = 1,names do
local namet = {}
for s = 1,math.random(2,3) do
local syll
repeat
syll = syl[math.random(1,#syl)]
until syll ~= namet[s-1]
table.insert(namet,syll)
end
namet[1] = string.upper(string.sub(namet[1],1,1))…string.sub(namet[1],2)
table.insert(namest,table.concat(namet))
end
local namestt = {}
for j,v in pairs(namest) do
table.insert(namestt,v)
if j < #namest then
table.insert(namestt," ")
end
end
namest = namestt
namestt = nil
return table.concat(namest)
end

for i = 1,5 do
print(GenerateName(math.random(2,3)))
end[/code]

Feel free to use it however you like.

Example output:

Kovcan Rujolas Jona
Encerie Rukov Obdofpil
Grifelda Rickfredgrin
Lianickru Fredvinvon Dofrie
1 Like

Okay, I’m definitely going to name some NPC or other Ooo Owowow Kraski.

Seriously though, this is significantly better than the list of 400 first names I plugged into my randomly-generating storekeeper.

EDIT: Its first choice is almost as good.
Busna Owful Meltri.

Your table is missing some whim and zee in it!

[quote] I spent today coding a name generation algorithm.

It combines commonly found syllables (and syllable pairs) in names to get a realistic output.

[code]syl = {“liz”,“beth”,“char”,“lie”,“rie”,“tri”,“von”,“do”,“wal”,“fra”,“mer”,“sha”,“ru”,“by”,“al”,“ex”,“ob”,“es”,“elda”,“cher”,“mo”,“mart”,“in”,“dy”,“can”,“an”,“kev”,“hin”,“du”,“fred”,“geof”,“rey”,“ney”,“aul”,“grim”,“grin”,“grif”,“on”,“pil”,“val”,“ray”,“ar”,“car”,“mel”,“dom”,“dor”,“nic”,“nik”,“las”,“o”,“ow”,“frey”,“un”,“roy”,“esh”,“flor”,“ence”,“encia”,“lor”,“ju”,“jen”,“jo”,“lia”,“rin”,“bal”,“rof”,“dof”,“ing”,“red”,“rus”,“bus”,“les”,“ful”,“nie”,“ska”,“fa”,“li”,“kra”,“kov”,“vin”,“sky”,“ski”,“don”,“cia”,“nick”,“rick”,“leo”,“thor”,“na”,}

function GenerateName(names)
local namest = {}
for n = 1,names do
local namet = {}
for s = 1,math.random(2,3) do
local syll
repeat
syll = syl[math.random(1,#syl)]
until syll ~= namet[s-1]
table.insert(namet,syll)
end
namet[1] = string.upper(string.sub(namet[1],1,1))…string.sub(namet[1],2)
table.insert(namest,table.concat(namet))
end
local namestt = {}
for j,v in pairs(namest) do
table.insert(namestt,v)
if j < #namest then
table.insert(namestt," ")
end
end
namest = namestt
namestt = nil
return table.concat(namest)
end

for i = 1,5 do
print(GenerateName(math.random(2,3)))
end[/code]

Feel free to use it however you like.

Example output:

Kovcan Rujolas Jona Nady Auldofcar Lithor Encerie Rukov Obdofpil Grifelda Rickfredgrin Lianickru Fredvinvon Dofrie [/quote]

Thank you for this. Needed one for interstellar can I use it?

Cool, I’m thinking the game Banished does this too seeing some of strange names my people usually end up with.

This is pretty awesome. Only wish I had uses for name generators.