A Javascript library which allows you to easily create Markov chains based on arbitrary dictionaries in order to create readable pseudo random words (Yes the name was generated by the library). See a demo of this library in action here
This library can be used from node.js, or from the browser using the browserify'd version in dist/foswig.js
var Foswig = require('foswig');
// Create the markov chain and specify the Order of the markov chain.
// The order (an integer > 0) indicates how many previous letters are
// taken into account when selecting the next. A smaller order will
// result in more randomized less recognizeable output. Conversely a
// higher order will result in words which resemble more closely those
// in the original dictionary.
var chain = new Foswig(3);
// add words into the markov chain one at a time
chain.addWordToChain("random");
//OR add all the words in an array at once
var dictionary = ["hello","foswig"];
chain.addWordsToChain(dictionary);
// generate a random word with a minimum of 5 characters, a maximum of 10 letters,
// and that cannot be a match to any of the input dictionaries words.
// NOTE: if it is not possible to generate the desired word length from the input
// dictionary, then this method will throw an Error after 25 failed attempts. This
// can be customized by adding a final parameter to the method indicating the maximum
// number of attempts to make when generating a word.
// e.g. chain.generateWord(5,10,false,100); for 100 attempts
var randomWord = chain.generateWord(5,10,false);
Foswig.js is licensed under the MIT license.