I thought it would be fun to do something like this a while ago but never bothered. I had a bit of spare time today so I made myself a little random word generator. Here it is:

function createRandomWord(length) {
    var consonants = 'bcdfghjklmnpqrstvwxyz',
        vowels = 'aeiou',
        rand = function(limit) {
            return Math.floor(Math.random()*limit);
        },
        i, word='', length = parseInt(length,10),
        consonants = consonants.split(''),
        vowels = vowels.split('');
    for (i=0;i<length/2;i++) {
        var randConsonant = consonants[rand(consonants.length)],
            randVowel = vowels[rand(vowels.length)];
        word += (i===0) ? randConsonant.toUpperCase() : randConsonant;
        word += i*2<length-1 ? randVowel : '';
    }
    return word;
}
 
alert( createRandomWord(10) );

It will alternate between consonants and vowels until it meets the specified length and then it will return a random word.

E.g.

  • Fanewera
  • Wifuwehi
  • Feranuro
  • Ponosive
  • Boviredo
  • Ravipare
  • Nujaruki

They’re kinda silly but actually a couple of them might make good company names, actually "Boviredo" sounds a bit like an Italian pasta dish!

See a demo of it here: demo/random-word

Anyway, it was just a bit of fun, nothing serious! Please note that it doesn’t create real words, just random combinations of letters, obviously it could create a real word (since it’s random) but don’t expect it to.

Thanks for reading! Please share your thoughts with me on Twitter. Have a great day!