For the complete documentation index, see llms.txt. This page is also available as Markdown.

Random Number Generating Methods

These methods create reproducible sequences of random numbers given an initial seed value.

This methods rely on the pure-rand project.

random

Generates random numbers using the Mersenne Twister generator whose values are within the range 0 to 0xffffffff.

const SEED = 5
const sequence: Seq<number> = random(SEED)
type random = (seed = DEFAULT_SEED) => Seq<number>

mersenne

Generates random numbers using the Mersenne Twister generator whose values are within the range 0 to 0xffffffff.

const SEED = 5
const sequence: Seq<number> = mersenne(SEED)
type mersenne = (seed = DEFAULT_SEED) => Seq<number>

xorshift128plus

Generates random numbers using the xorshift128+ generator whose values are within the range -0x80000000 to 0x7fffffff.

const SEED = 5
const sequence: Seq<number> = xorshift128plus(SEED)
type xorshift128plus = (seed = DEFAULT_SEED) => Seq<number>

xoroshiro128plus

Generates random numbers using the xoroshiro128+ generator whose values are within the range -0x80000000 to 0x7fffffff.

congruential

Generates random numbers using a Linear Congruential generator whose values are within the range 0 to 0x7fff.

congruential32

Generates random numbers using a Linear Congruential generator whose values are within the range 0 to 0xffffffff.

Last updated

Was this helpful?