# seed-random

> Generate random numbers with a seed, useful for reproducible tests

Latest version **2.2.0** (published 2013-11-11) · MIT license · 0 weekly downloads

## Install

```sh
npm install seed-random
pnpm add seed-random
yarn add seed-random
bun add seed-random
```

## Health

**Score 23/100 (F)** — status: abandoned.

Positive: has types package; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.2.0 |
| Published | 2013-11-11 |
| First published | 2012-11-23 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | separate (@types/seed-random) |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 40 |
| Author | ForbesLindesay |
| Maintainers | forbeslindesay |

## Links

- npm: https://www.npmjs.com/package/seed-random
- Repository: https://github.com/ForbesLindesay/seed-random
- Issues: https://github.com/ForbesLindesay/seed-random/issues
- npm.io page: https://npm.io/package/seed-random

## Recent versions

- 2.2.0 (latest) — 2013-11-11
- 1.0.1 — 2012-11-23
- 1.0.0 — 2012-11-23

## README

# seed-random

Generate random numbers with a seed, useful for reproducible tests


[![build status](https://secure.travis-ci.org/ForbesLindesay/seed-random.png?branch=master)](http://travis-ci.org/ForbesLindesay/seed-random)
[![Dependency Status](https://img.shields.io/david/ForbesLindesay/seed-random.svg)](https://david-dm.org/ForbesLindesay/seed-random)
[![NPM version](https://img.shields.io/npm/v/seed-random.svg)](https://www.npmjs.com/package/seed-random)

## Installation

    $ npm install seed-random

## API

```javascript
var assert = require('assert');
var seed = require('../');

var trueRandomA = seed();
var trueRandomB = seed();
assert(trueRandomA() != trueRandomB());

var fakeRandomA = seed('foo');
var fakeRandomB = seed('foo');
assert(fakeRandomA() == fakeRandomB());

var fakeRandomC = seed('foo', {entropy: true});
var fakeRandomD = seed('foo', {entropy: true});
assert(fakeRandomC() != fakeRandomD());


seed('foo', {global: true});//over-ride global Math.random
var numA = Math.random();
seed('foo', {global: true});
var numB = Math.random();
assert(numA == numB);//always true

seed.resetGlobal();//reset to default Math.random
```

## License

MIT

---
_Source: https://npm.io/package/seed-random · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
