A randomized array prototype
var Randomized = ;var random = 'foo' 'bar' 'baz' 'quux' 'cats';// Use random.fn.get() to get random element(s). With no parameters, defaults to one.console;// #> "cats"// Or pass in a quantityconsole;// #> ["bar", "cats", "foo"];
Supports server-side usage in Node as well as browser-based usage (with or without AMD).
Without AMD in the browser, it attaches to RandomizedArray on the window object.
Basic tests are available with vows. Install dev-dependencies (
npm install -d) and run with npm: