{"name":"alea","version":"0.0.7","description":"Implementation of the Alea PRNG by Johannes Baagøe","main":"alea.js","scripts":{"test":"node test"},"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,3.5,3.6,4,17,"nightly"],"chrome":[20,21,22,23,"canary"],"opera":[10,10.5,11,11.5,11.6,12,"next"],"safari":[5.05,5.1]}},"license":"WTFPL","_id":"alea@0.0.7","dist":{"shasum":"36568f01fc4a58cc0df9d45945f21e50fe6fe4f7","tarball":"http://registry-npm.ywwl.com/alea/download/alea-0.0.7.tgz","integrity":"sha512-FPWMv8o7vaXhZr74OmrElg8IBUpwwFgCAVelD8qJX/8n5gB9jrTO3+W3anJq42DLkRYtsxiTL/ed8b0ID1R3bw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQC45quTW3iqtm18avLd2sDOEnwhtocoQOS8G/8hUnncjgIhAK7gECbtq2Kzb2uVu/X3z/nHLAvBrj+rI3lqT3eQe29E"}],"size":2749,"noattachment":false,"key":"/alea/-/alea-0.0.7.tgz"},"_npmVersion":"1.1.66","_npmUser":{"name":"coverslide","email":"coverslide@gmail.com"},"maintainers":[{"name":"coverslide","email":"coverslide@gmail.com"}],"directories":{},"readme":"# 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","publish_time":1355501496488,"_cnpm_publish_time":1355501496488,"dist-tags":{"latest":"1.0.1"}}