{"_id":"knuth-shuffle","_rev":"37-b713a109cca8496a88f3efe61a02cee0","name":"knuth-shuffle","description":"The Fisher-Yates (aka Knuth) shuffle for Browser and Node.js","dist-tags":{"latest":"1.0.8"},"versions":{"1.0.0":{"name":"knuth-shuffle","version":"1.0.0","description":"The Fisher-Yates (aka Knuth) shuffle for Browser and Node.js","main":"index.js","scripts":{"test":"node example.js"},"repository":{"type":"git","url":"git://github.com/coolaj86/knuth-shuffle.git"},"keywords":["ronald","fisher","frank","yates","fisher-yates","donald","knuth","shuffle","random","randomize","unbiased","algorithm"],"author":{"name":"AJ ONeal","email":"coolaj86@gmail.com","url":"http://coolaj86.info/"},"license":"Apache2","bugs":{"url":"https://github.com/coolaj86/knuth-shuffle/issues"},"_id":"knuth-shuffle@1.0.0","dist":{"shasum":"c11341f8c99d10e456a80aec3060bf330a2358e0","tarball":"https://registry.npmjs.org/knuth-shuffle/-/knuth-shuffle-1.0.0.tgz","integrity":"sha512-FCa11R4oHWX3o9cK5+tTVuaMduDaHUfDy7aesPPSjhgHVXQ/Y7qiLfcvI/oZTKIcu8J6Hqlq1IjCKxNahyO/eQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIC7D3Lqyg/GduneyGkI1Qe6Gpfp06p90ZCuvm5DvRcvBAiEAhfQPStPaFRsVVY6inAmSPqGRqp/gpO0yIzTjIweA4ig="}]},"_from":"./","_npmVersion":"1.3.11","_npmUser":{"name":"coolaj86","email":"coolaj86@gmail.com"},"maintainers":[{"name":"coolaj86","email":"coolaj86@gmail.com"}],"directories":{}},"1.0.1":{"name":"knuth-shuffle","version":"1.0.1","description":"The Fisher-Yates (aka Knuth) shuffle for Browser and Node.js","main":"index.js","scripts":{"test":"node example.js"},"repository":{"type":"git","url":"git://github.com/coolaj86/knuth-shuffle.git"},"keywords":["ronald","fisher","frank","yates","fisher-yates","donald","knuth","shuffle","random","randomize","unbiased","algorithm"],"author":{"name":"AJ ONeal","email":"coolaj86@gmail.com","url":"http://coolaj86.info/"},"license":"Apache2","bugs":{"url":"https://github.com/coolaj86/knuth-shuffle/issues"},"homepage":"https://github.com/coolaj86/knuth-shuffle","_id":"knuth-shuffle@1.0.1","_shasum":"454940ae816c14e1af6e6f09d8828818f95b5191","_from":"./","_npmVersion":"1.4.9","_npmUser":{"name":"coolaj86","email":"coolaj86@gmail.com"},"maintainers":[{"name":"coolaj86","email":"coolaj86@gmail.com"}],"dist":{"shasum":"454940ae816c14e1af6e6f09d8828818f95b5191","tarball":"https://registry.npmjs.org/knuth-shuffle/-/knuth-shuffle-1.0.1.tgz","integrity":"sha512-KdHo0ywZNtpMSZ64tDSsrGk3ttah44WqtOqxt4ApQnOnT2tkJNcAGlBXP39ljllEKsVPTrntZaUho+Dr6KKK+A==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC1M+cdiNGHADfqZkU8H3pn6D6XEU4OoD1wcGYr+vE8fQIgZaiEA0h0dqImYaomBM+puT5yJn9gShRGiIOiKiWG9tk="}]},"directories":{}},"1.0.8":{"name":"knuth-shuffle","version":"1.0.8","description":"The Fisher-Yates (aka Knuth) shuffle for Browser and Node.js","main":"index.js","homepage":"https://git.coolaj86.com/coolaj86/knuth-shuffle.js","scripts":{"test":"node example.js"},"repository":{"type":"git","url":"git://git.coolaj86.com:coolaj86/knuth-shuffle.js.git"},"keywords":["ronald","fisher","frank","yates","fisher-yates","donald","knuth","shuffle","random","randomize","unbiased","algorithm"],"author":{"name":"AJ ONeal","email":"coolaj86@gmail.com","url":"https://coolaj86.com/"},"license":"(MIT OR Apache-2.0)","bugs":{"url":"https://git.coolaj86.com/coolaj86/knuth-shuffle/issues"},"gitHead":"c60dcd6828e06db624a8d615ef890329a3081979","_id":"knuth-shuffle@1.0.8","_npmVersion":"5.4.2","_nodeVersion":"8.8.1","_npmUser":{"name":"coolaj86","email":"coolaj86@gmail.com"},"dist":{"integrity":"sha512-IdC4Hpp+mx53zTt6VAGsAtbGM0g4BV9fP8tTcviCosSwocHcRDw9uG5Rnv6wLWckF4r72qeXFoK9NkvV1gUJCQ==","shasum":"929a467b0efd8d297bdcf318ca988a9f1037f80d","tarball":"https://registry.npmjs.org/knuth-shuffle/-/knuth-shuffle-1.0.8.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIBSM1Rr+sOuuccoVocf58fDQ4yYZ+1phbcK9JfFW0f4dAiEAuCz1JUZayOXghn7v+9y6O7JrYOicFnMQHLM9vxdocmk="}]},"maintainers":[{"name":"coolaj86","email":"coolaj86@gmail.com"},{"name":"creationix","email":"tim@creationix.com"},{"name":"daplieinc","email":"npm@daplie.com"},{"name":"drewwarrentiy","email":"drewwarrentiy@gmail.com"},{"name":"insightfuls","email":"insightful_schmidt@yahoo.com.au"},{"name":"jimh","email":"jim.hager@daplie.com"},{"name":"tigerbot","email":"slgibelyou@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/knuth-shuffle-1.0.8.tgz_1509250350769_0.6957990622613579"},"directories":{}}},"readme":"knuth-shuffle\n=============\n\nThe Fisher-Yates (aka Knuth) shuffle for Browser and Node.js\n\n  * [Mike Bostock's Fisher–Yates Shuffle Visualization](http://bost.ocks.org/mike/shuffle/)\n  * [How to randomize/shuffle a JavaScript array](http://stackoverflow.com/questions/2450954/how-to-randomize-shuffle-a-javascript-array)\n  * [Fisher-Yates Shuffle on Wikipedia](http://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle)\n  * [Doing the Microsoft Shuffle: Algorithm Fail in Browser Ballot](http://www.robweir.com/blog/2010/02/microsoft-random-browser-ballot.html)\n  * [knuth-shuffle on NPM](https://npmjs.org/package/knuth-shuffle)\n\n'nuf said.\n\nThe Fisher-Yates (Knuth) Shuffle\n===\n\nAs Microsoft learned the hard way (see article below), `function random() { return 0.5 - Math.random() }` turns out to be no-so-random at all.\n\nThe fisher-yates shuffle is an algorithm so simple that even\n[IEEE floating point math](http://blogs.adobe.com/bparadie/2011/11/22/0-2-0-1-0-30000000000000004/)\ncan't screw it up!\n\nI put this on npm as `knuth-shuffle` because `fisher-yates-shuffle`\nwas just too long of a name and shuffle was already taken.\n\nBrowser Example\n===\n\n```html\n<script src=\"https://raw.github.com/coolaj86/knuth-shuffle/master/index.js\"></script>\n```\n\n```javascript\n(function () {\n  'use strict';\n\n  var a = [2,11,37,42];\n  var b;\n\n  // The shuffle modifies the original array\n  // calling a.slice(0) creates a copy, which is assigned to b\n  b = window.knuthShuffle(a.slice(0));\n  console.log(b);\n}());\n```\n\nNode Example\n===\n\nDecentralized Install\n\n```bash\nnpm install --save git+https://git.coolaj86.com/coolaj86/knuth-shuffle.js.git#v1.0\n```\n\nCentralized Install\n\n```bash\nnpm install --save knuth-shuffle@1.0\n```\n\n```javascript\n(function () {\n  'use strict';\n\n  var shuffle = require('knuth-shuffle').knuthShuffle;\n  var a = [2,11,37,42];\n  var b;\n\n  // The shuffle modifies the original array\n  // calling a.slice(0) creates a copy, which is assigned to b\n  b = shuffle(a.slice(0));\n  console.log(b);\n}());\n```\n","maintainers":[{"email":"coolaj86@gmail.com","name":"coolaj86"}],"time":{"modified":"2022-06-19T09:08:33.064Z","created":"2013-12-03T07:50:29.883Z","1.0.0":"2013-12-03T07:50:34.826Z","1.0.1":"2014-09-28T09:22:27.539Z","1.0.2":"2017-10-29T03:51:59.264Z","1.0.3":"2017-10-29T03:54:26.387Z","1.0.5":"2017-10-29T03:55:43.364Z","1.0.6":"2017-10-29T04:00:36.450Z","1.0.7":"2017-10-29T04:11:19.033Z","1.0.8":"2017-10-29T04:12:30.880Z"},"author":{"name":"AJ ONeal","email":"coolaj86@gmail.com","url":"https://coolaj86.com/"},"repository":{"type":"git","url":"git://git.coolaj86.com:coolaj86/knuth-shuffle.js.git"},"keywords":["ronald","fisher","frank","yates","fisher-yates","donald","knuth","shuffle","random","randomize","unbiased","algorithm"],"bugs":{"url":"https://git.coolaj86.com/coolaj86/knuth-shuffle/issues"},"license":"(MIT OR Apache-2.0)","readmeFilename":"README.md","users":{"zapo":true,"ukrbublik":true},"homepage":"https://git.coolaj86.com/coolaj86/knuth-shuffle.js"}