{"_id":"seed-random","_rev":"159426","name":"seed-random","description":"Generate random numbers with a seed, useful for reproducible tests","dist-tags":{"latest":"2.2.0"},"maintainers":[{"name":"forbeslindesay","email":"forbes@lindesay.co.uk"},{"name":"timothygu","email":"timothygu99@gmail.com"}],"time":{"modified":"2021-06-03T11:38:55.000Z","created":"2012-11-23T20:30:34.901Z","2.2.0":"2013-11-11T16:34:11.102Z","1.0.1":"2012-11-23T20:31:07.931Z","1.0.0":"2012-11-23T20:30:34.901Z"},"users":{"lenville":true,"dazld":true,"farskipper":true,"thevikingcoder":true,"noopkat":true},"author":{"name":"ForbesLindesay"},"repository":{"type":"git","url":"https://github.com/ForbesLindesay/seed-random.git"},"versions":{"2.2.0":{"name":"seed-random","version":"2.2.0","description":"Generate random numbers with a seed, useful for reproducible tests","main":"index.js","scripts":{"test":"node test/index.js"},"repository":{"type":"git","url":"https://github.com/ForbesLindesay/seed-random.git"},"author":{"name":"ForbesLindesay"},"license":"MIT","readmeFilename":"Readme.md","bugs":{"url":"https://github.com/ForbesLindesay/seed-random/issues"},"_id":"seed-random@2.2.0","dist":{"shasum":"2a9b19e250a817099231a5b99a4daf80b7fbed54","size":4611,"noattachment":false,"key":"/seed-random/-/seed-random-2.2.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/seed-random/download/seed-random-2.2.0.tgz"},"_from":".","_npmVersion":"1.3.8","_npmUser":{"name":"forbeslindesay","email":"forbes@lindeay.co.uk"},"maintainers":[{"name":"forbeslindesay","email":"forbes@lindesay.co.uk"},{"name":"timothygu","email":"timothygu99@gmail.com"}],"directories":{},"publish_time":1384187651102,"_cnpm_publish_time":1384187651102,"_hasShrinkwrap":false},"1.0.1":{"name":"seed-random","version":"1.0.1","description":"Generate random numbers with a seed, useful for reproducible tests","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"https://github.com/ForbesLindesay/seed-random.git"},"author":"","license":"MIT","_id":"seed-random@1.0.1","dist":{"shasum":"f35e786d12f9496f109d6fd3bf50c720877c42cb","size":2813,"noattachment":false,"key":"/seed-random/-/seed-random-1.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/seed-random/download/seed-random-1.0.1.tgz"},"_npmVersion":"1.1.59","_npmUser":{"name":"forbeslindesay","email":"forbes@lindesay.co.uk"},"maintainers":[{"name":"forbeslindesay","email":"forbes@lindesay.co.uk"},{"name":"timothygu","email":"timothygu99@gmail.com"}],"directories":{},"publish_time":1353702667931,"_cnpm_publish_time":1353702667931,"_hasShrinkwrap":false},"1.0.0":{"name":"seed-random","version":"1.0.0","description":"Generate random numbers with a seed, useful for reproducible tests","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"https://github.com/ForbesLindesay/seed-random.git"},"author":"","license":"MIT","_id":"seed-random@1.0.0","dist":{"shasum":"3bc5d6cc3012bdf308ecbfa7c0910710d29ee1bb","size":2815,"noattachment":false,"key":"/seed-random/-/seed-random-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/seed-random/download/seed-random-1.0.0.tgz"},"_npmVersion":"1.1.59","_npmUser":{"name":"forbeslindesay","email":"forbes@lindesay.co.uk"},"maintainers":[{"name":"forbeslindesay","email":"forbes@lindesay.co.uk"},{"name":"timothygu","email":"timothygu99@gmail.com"}],"directories":{},"publish_time":1353702634901,"_cnpm_publish_time":1353702634901,"_hasShrinkwrap":false}},"readme":"# seed-random\r\n\r\nGenerate random numbers with a seed, useful for reproducible tests\r\n\r\n\r\n[![build status](https://secure.travis-ci.org/ForbesLindesay/seed-random.png?branch=master)](http://travis-ci.org/ForbesLindesay/seed-random)\r\n[![Dependency Status](https://gemnasium.com/ForbesLindesay/seed-random.png)](https://gemnasium.com/ForbesLindesay/seed-random)\r\n[![NPM version](https://badge.fury.io/js/seed-random.png)](http://badge.fury.io/js/seed-random)\r\n\r\n## Installation\r\n\r\n    $ npm install seed-random\r\n\r\n## API\r\n\r\n```javascript\r\nvar assert = require('assert');\r\nvar seed = require('../');\r\n\r\nvar trueRandomA = seed();\r\nvar trueRandomB = seed();\r\nassert(trueRandomA() != trueRandomB());\r\n\r\nvar fakeRandomA = seed('foo');\r\nvar fakeRandomB = seed('foo');\r\nassert(fakeRandomA() == fakeRandomB());\r\n\r\nvar fakeRandomC = seed('foo', {entropy: true});\r\nvar fakeRandomD = seed('foo', {entropy: true});\r\nassert(fakeRandomC() != fakeRandomD());\r\n\r\n\r\nseed('foo', {global: true});//over-ride global Math.random\r\nvar numA = Math.random();\r\nseed('foo', {global: true});\r\nvar numB = Math.random();\r\nassert(numA == numB);//always true\r\n\r\nseed.resetGlobal();//reset to default Math.random\r\n```\r\n\r\n## License\r\n\r\nMIT\r\n","_attachments":{},"readmeFilename":"Readme.md","bugs":{"url":"https://github.com/ForbesLindesay/seed-random/issues"},"license":"MIT"}