# algoritmo – Algorithm for name generation

## Question:

I did a lot of research but I didn't find an algorithm that does something like banks do. For example, when you first register at a 24-hour teller, the machine will generate a password. In general, 3 or 4 pairs of letters are given as a password.

However, if observed, the letters they automatically generate make some sense if read as a word.

Example:

CE LA LU / XE GO U

Is something known that accomplishes what I desire?

Thanks!

I made an algorithm like this in 2008. It ran in PHP.

The initial idea was like @Motta's comment.
Two lists: one for consonants and one for vowels:

``````ListaConsoantes = b c d f g j k l m n p r s t v x
ListaVogais = a e i o u
``````

I improved the consonants and vowels to form more complex words:

``````ListaConsoantes  = b c d f g j k l m n p r s t v x
ListaConsoantes2 = ch qu gu lh
ListaConsoantesFim = s x r l m
ListaVogais      = a e i o u y
ListaVogais2     = au ei oa ya
``````

The function received the number of characters for the password to be generated, but this number was considered the minimum for the algorithm to be able to complete the word, not stop in the middle of a syllable.

These phonemes can be expanded and tweaked as you wish.

the algorithm looked something like this (in pseudocode):

``````size = 8
senha = ''
if ( rand entre 0 ou 1 )
// inicio com uma vogal simples ou não da ListaVogais [1]
senha = ListaVogais[ rand ]
while senha.size < size
// sorteio se uso uma consoante de ListaConsoantes ou ListaConsoantes2 [2]
if ( rand entre 0 ou 1 )
senha = senha + ListaConsoantes[ rand ]
else
senha = senha + ListaConsoantes2[ rand ]

// sorteio se uso uma vogal de ListaVogais ou ListaVogais2 [3]
if ( rand entre 0 ou 1 )
senha = senha + ListaVogais[ rand ]
else
senha = senha + ListaVogais2[ rand ]

// sorteio se uso uma consoante no fim da palavra [4]
if ( rand entre 0 ou 1 )
senha = senha + ListaConsoantesFim[ rand ]
``````

Get out, a pretty cool passwords.

could leave due to [1]:

baquichoba or abaquichoba

could leave due to [2]: