Skip to content

A simple fast space-efficient statistically good algorithm for random number generation in JavaScript

License

Notifications You must be signed in to change notification settings

mawi12345/pcg32

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pcg32.js

open issues npm version

A simple fast space-efficient statistically good algorithm for random number generation in JavaScript.

Installation

npm install pcg32

or

yarn add pcg32

Usage

var PCG32 = require('pcg32')

var seed = 42;
var stream = 54;

var pcg32 = new PCG32(seed, stream);

// Print a radnom number between 0 and 4294967295
console.log(pcg32.random());

// Print a radnom number between 0 and 5
console.log(pcg32.random(6));

// Print 0 or 1
console.log(pcg32.random(2));

About

A simple fast space-efficient statistically good algorithm for random number generation in JavaScript

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published