Class: Mulberry32

Mulberry32(seed)

Mulberry32 Pseudorandom Number Generator Class

Constructor

new Mulberry32(seed)

Implements the Mulberry32 algorithm to generate pseudorandom numbers.

This class provides the Mulberry32 method of generating psuedorandom numbers to the PRNG class.

The Mulberry32 algorithm was written by Tommy Ettinger in 2017 and is released to the public domain, meaning it can be freely used, modified, and distributed without restrictions.

Parameters:
Name Type Description
seed number

The seed value for the Mulberry32 PRNG.

Implements:
Source:
See:
Example
const rng = new Mulberry32(123456789);
console.log(rng.next()); // Generates a pseudorandom number

Classes

Mulberry32

Implements the Mulberry32 algorithm to generate pseudorandom numbers.

Methods

next() → {number}

Generates the next psuedo-random number.

Source:
Returns:

A number in the range [0-1).

Type
number
Example
// Returns a random number in the range [0-1)
const rng = new Mulberry32();
console.log(rng.next());