I need to figure out an algorithm or, even better, if there is an implementation in php/java to generate words which will be suggested to user to choose like some identifiers but I want them to be somewhat easy to remember, eg 'wonifuxa', 'thonqi', 'oqriman' and so on but not something like 'nxdFgtqI'
private static string RandomWord(int length)
{
var consonants = new[] { "b", "c", "d", "f", "g", "h", "j", "k", "l", "m", "n", "p", "r", "s", "t", "v", "w", "x", "y", "z" };
var vowels = new[] { "a", "e", "i", "o", "u" };
var word = "";
var b = true;
for (var i = 0; i < length; i++)
{
word += b ? consonants[Rng.Next(consonants.Length)] : vowels[Rng.Next(vowels.Length)];
b = !b;
}
return word;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With