{"name":"alea","version":"0.0.0","description":"Implementation of the Alea PRNG by Johannes Baagøe","main":"alea.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":"","author":"","license":"BSD","_id":"alea@0.0.0","dist":{"shasum":"20e8c7ab2d536a62dd2f64bf82473cfeb0f4ff16","tarball":"http://registry-npm.ywwl.com/alea/download/alea-0.0.0.tgz","integrity":"sha512-wM43nTwrY0DEFQT1tNz+k/aKQ/Kz/0doH9XhByfngT7ptPZMReggVzB3+8NcehRi0nVsqJBov64C7SQLupKbaA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIEpXbRW9pRKikqXduMXDRrA9joUyothcYtZU2iFl+lbeAiBwA8LkrmeuaeehaWijBwsIGol1tME0iacb8rh98GGb2w=="}],"size":1242,"noattachment":false,"key":"/alea/-/alea-0.0.0.tgz"},"_npmVersion":"1.1.63","_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":1350684403190,"_cnpm_publish_time":1350684403190,"dist-tags":{"latest":"1.0.1"}}