best-random
TypeScript icon, indicating that this package has built-in type declarations

1.0.3 • Public • Published

best-random

A humble replacement for Math.random() that is tiny, fast, seedable, and has good statistical properties.

Overview

  • Suitable for non-cryptographic applications
  • Passes most statistical tests
  • Period of ~2128
  • ~600 bytes
  • Very fast

Installation

npm i best-random --save

Usage

const { Random } = require("best-random");

const rnd = new Random(/* seed: */ 42);     // New PRNG w/seed 42

console.log(rnd.float64());                 // Always prints '0.60829943369486'
console.log(rnd.uint32());                  // Always prints '803767485'
console.log(rnd.uint53());                  // Always prints '6835035088404228'

Package Sidebar

Install

npm i best-random

Weekly Downloads

2,554

Version

1.0.3

License

MIT

Unpacked Size

5.44 kB

Total Files

5

Last publish

Collaborators

  • dlehenbauer