small-prng

1.0.0 • Public • Published

small-prng

A fast, seedable replacement for Math.random().

npm Node.js Build Status Code Coverage Maintainability Dependencies Status MIT licensed

Installation

npm i small-prng

Usage

Exported global function

The seed for the exported function random() is based on process.hrtime() when the module is first required.

const { random } = require('small-prng');
 
random();

Creating a seeded PRNG

To create a seeded PRNG, use the exported function prng(). Calling prng() without any arguments will use process.hrtime() as the seed.

const { prng } = require('small-prng');
 
const mySeed = 1;
const random = prng(mySeed);
 
random();

License

The majority of the code in this repository is released under the MIT license. However, the JavaScript port of Bob Jenkins's small noncryptographic PRNG in src/prng.js is public domain.

Readme

Keywords

none

Package Sidebar

Install

npm i small-prng

Weekly Downloads

0

Version

1.0.0

License

MIT

Unpacked Size

7.33 kB

Total Files

6

Last publish

Collaborators

  • connorwiseman