master
Raw Download raw file
 1{
 2  "name": "seed-random",
 3  "version": "2.2.0",
 4  "description": "Generate random numbers with a seed, useful for reproducible tests",
 5  "main": "index.js",
 6  "scripts": {
 7    "test": "node test/index.js"
 8  },
 9  "repository": {
10    "type": "git",
11    "url": "https://github.com/ForbesLindesay/seed-random.git"
12  },
13  "author": {
14    "name": "ForbesLindesay"
15  },
16  "license": "MIT",
17  "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",
18  "readmeFilename": "Readme.md",
19  "bugs": {
20    "url": "https://github.com/ForbesLindesay/seed-random/issues"
21  },
22  "homepage": "https://github.com/ForbesLindesay/seed-random",
23  "_id": "seed-random@2.2.0",
24  "_from": "seed-random@*"
25}