Java – How to generate pseudo-random “readable” strings in Java

algorithmcjavarandomstring

Generating a truly random string of a given length is a fairly straightforward (and already-well-covered) task.

However; I'd like to generate a "pseudo" random string with the additional constraint that it be relatively easily readable (to a native-English reader.)

I think another way to say this is to say that the generated string should consist of "recognizable syllables." For example, "akdjfwv" is a random string, but it's not recognizable at all. "flamyom"; however, is very "recognizable" (even though it's nonsense.)

Obviously, one could make a long list of "recognizable syllables," and then randomly select them.

But, is there a better way to do something like programmatically generate a "recognizable syllable," or generate a "syllable" and then test it to see if it's "recognizable"?

I can think of several ways to go about this implementation, but if someone has already implemented it (preferrably in Java or C#,) I'd rather re-use their work.

Any ideas?

Best Answer

I think this should do what you want:

Java Password Generator

It has the source code and a permissive license so you can adapt the source code to what you are looking for.