seed-random

WebJar for seed-random

License

License

MIT
GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

seed-random
Last Version

Last Version

2.2.0
Release Date

Release Date

Type

Type

jar
Description

Description

seed-random
WebJar for seed-random
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

https://github.com/ForbesLindesay/seed-random

Download seed-random

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.npm/seed-random/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>seed-random</artifactId>
    <version>2.2.0</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/seed-random/
implementation 'org.webjars.npm:seed-random:2.2.0'
// https://jarcasting.com/artifacts/org.webjars.npm/seed-random/
implementation ("org.webjars.npm:seed-random:2.2.0")
'org.webjars.npm:seed-random:jar:2.2.0'
<dependency org="org.webjars.npm" name="seed-random" rev="2.2.0">
  <artifact name="seed-random" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='seed-random', version='2.2.0')
)
libraryDependencies += "org.webjars.npm" % "seed-random" % "2.2.0"
[org.webjars.npm/seed-random "2.2.0"]

Dependencies

There are no dependencies for this project. It is a standalone project that does not depend on any other jars.

Project Modules

There are no modules declared in this project.

seed-random

Generate random numbers with a seed, useful for reproducible tests

build status Dependency Status NPM version

Installation

$ npm install seed-random

API

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

Versions

Version
2.2.0