# Algorithm for generating names

## Question:

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

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

Example:

CE LA LU / XE GO U

Is it known something that accomplishes what I want?

Thanks!

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

The initial idea was like the @Motta 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 as a minimum so that the algorithm could complete the word, not stop in the middle of a syllable.

These phonemes can be enlarged and moved as you like.

the algorithm looked 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 ]
``````

Come out, a pretty cool passwords.

could leave due to [1]:

baquichoba or baquichoba

could leave due to [2]: