{"name":"alea","version":"0.0.2","description":"Implementation of the Alea PRNG by Johannes Baagøe","main":"alea.js","scripts":{"test":"node test"},"repository":{"type":"git","url":"https://github.com/coverslide/node-alea"},"author":"","license":"BSD","_id":"alea@0.0.2","_from":"alea","dist":{"shasum":"89592554231c7c841fee9ad310459e164bfeee72","tarball":"http://registry-npm.ywwl.com/alea/download/alea-0.0.2.tgz","integrity":"sha512-iqk0Fpj/mDiKz0hApEj6AWjwAceQ5qH8qjNiRGxbjM4V98JRgGMS1GXqqTSjh6jw9N69085h/9QvMwsQ7RZF/A==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQD7UMvsM7crlI6NYLsLijLTHq1yFIhzoBJnAvjytjjuRwIgBX99DRduDUkZZwsScE3vXTyBQ8y9ZZStS9DubpfXIBU="}],"size":2183,"noattachment":false,"key":"/alea/-/alea-0.0.2.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":1355496104063,"_cnpm_publish_time":1355496104063,"dist-tags":{"latest":"1.0.1"}}