You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

best-random

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

best-random

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

1.0.3
latest
Source
npmnpm
Version published
Weekly downloads
681
-54.75%
Maintainers
1
Weekly downloads
 
Created
Source

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'

Keywords

random

FAQs

Package last updated on 21 May 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts