{"name":"alea","version":"0.0.9","description":"Implementation of the Alea PRNG by Johannes Baagøe","main":"alea.js","scripts":{"test":"node test"},"keywords":["badass","pseudo","random","number","generator"],"devDependencies":{"tape":"~0.1.1"},"repository":{"type":"git","url":"https://github.com/coverslide/node-alea"},"author":{"name":"Richard Hoffman","email":"coverslide@gmail.com","url":"http://coverslide.me"},"testling":{"files":"test.js","browsers":{"ie":[6,7,8,9],"ff":[3.6,4,17,"nightly"],"chrome":[22,23,"canary"],"opera":[10,11,12,"next"],"safari":[5.1]}},"license":"MIT","readme":"# Alea\n\n[![browser support](http://ci.testling.com/coverslide/node-alea.png)](http://ci.testling.com/coverslide/node-alea)\n\nA simple copy-and-paste implementation of Johannes Baagøe's Alea PRNG\n\nMostly packaged so I can easily include it in my projeccts. Nothing more\n\nJavaScript's Math.random() is fast, but has problems. First, it isn't seedable, second, its randomness leaves a bit to be desired. [Johannes Baagøe](http://baagoe.org/) has done some great work in trying to find a more modern PRNG algorithm that performs well on JavaScript, and Alea seems to be the one that has come out ahead ([benchmarks](http://jsperf.com/prng-comparison)).\n\n## Installation\n\n\tnpm install alea\n\n## Usage\n\n\tvar Alea = require('alea')\n\t\n\tvar prng = new Alea() // add an optional seed param\n\n\tvar nextRandnum = prng() // just call the return value of Alea\n\n## Additions\n\nAlso adds the ability to sync up two Alea PRNGs via the importState and exportState methods.\n\n\tvar prng1 = new Alea(200)\n\n\tprng1()\n\tprng1()\n\n\t// after generating a few random numbers, we will initialize a new PRNG\n\n\tvar prng2 = Alea.importState(prng1.exportState())\n\n\t// this should echo true, true, true\n\tconsole.log(prng2() == prng1())\n\tconsole.log(prng2() == prng1())\n\tconsole.log(prng2() == prng1())\n\nThe theory behind this is that while a server is running a simulation (for example, a game) and clients connect to the server, each client will run its own simulation without having to depend 100% on the server for every update of the simulation state. By importing the current generator state from the server, a client can join in at any time and have an accurate simulation fully in sync with the server.\n\n## Acknowledgements\n\nEverything in this module was made by Johannes Baagøe. I just wanted this in npm.\nRead more on his [homepage](http://baagoe.org/).\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/coverslide/node-alea/issues"},"homepage":"https://github.com/coverslide/node-alea","_id":"alea@0.0.9","_shasum":"f738cb45f83430069f45cf69ccbf312dd57a9e1a","_from":"https://registry.npmjs.org/alea/-/alea-0.0.9.tgz","_resolved":"https://registry.npmjs.org/alea/-/alea-0.0.9.tgz"}