pax_global_header00006660000000000000000000000064123542467350014525gustar00rootroot0000000000000052 comment=7e2fe37872816db64b406611354ac7733fb9b31f node-mess-0.1.2/000077500000000000000000000000001235424673500134175ustar00rootroot00000000000000node-mess-0.1.2/.gitignore000066400000000000000000000000071235424673500154040ustar00rootroot00000000000000/.idea node-mess-0.1.2/README.md000066400000000000000000000012571235424673500147030ustar00rootroot00000000000000mess ==== Missing shuffle function for arrays in javascript. This is [Fisher–Yates shuffle](https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle), and it's very fast. ## Installation ``` npm install mess ``` ## Usage ```javascript var mess = require("mess"); console.log(mess([1,2,3,4,5,6,7,8,9,0])); // output will be something like: // [ 7, 9, 2, 0, 6, 8, 5, 3, 1, 4 ] ``` ## Why mess Because naming modules is hard and shuffle is already taken. ## Authors * [Ronald Fisher and Frank Yates](https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle) * [People on internet](http://stackoverflow.com/questions/6274339/how-can-i-shuffle-an-array-in-javascript#6274398) node-mess-0.1.2/index.js000066400000000000000000000010621235424673500150630ustar00rootroot00000000000000(function(module) { // see https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle // and http://stackoverflow.com/questions/6274339/how-can-i-shuffle-an-array-in-javascript#6274398 module.exports = function shuffle(array) { var counter = array.length, temp, index; while (counter) { index = Math.floor(Math.random() * counter--); temp = array[counter]; array[counter] = array[index]; array[index] = temp; } return array; } })(module); node-mess-0.1.2/package.json000066400000000000000000000012221235424673500157020ustar00rootroot00000000000000{ "name": "mess", "version": "0.1.2", "description": "Mess is Fisher–Yates shuffle algorithm implementation for node.js", "main": "index.js", "scripts": { "test": "echo \"Error: no test specified\" && exit 1" }, "repository": { "type": "git", "url": "git@github.com:bobrik/node-mess.git" }, "keywords": [ "mess", "shuffle", "array_shuffle", "random", "fisher", "yates", "array" ], "author": "Ian Babrou (http://bobrik.name/)", "license": "BSD", "bugs": { "url": "https://github.com/bobrik/node-mess/issues" }, "homepage": "https://github.com/bobrik/node-mess" }