Module description

rng -- Pseudo random number generator module
The rng module implements a pseudo random number generator; it uses the Mersenne Twister as generator with a period of 2^19937 - 1.

Random generator structure

rng% ( -- n )
Get the required space for a rng variable

Random generator creation, initialisation and destruction

rng-init ( u rng -- )
Initialise the generator with the seed u
rng-create ( u "<spaces>name" -- ; -- rng )
Create a named random generator in the dictionary with seed u
rng-new ( u -- rng )
Create a new random generator on the heap with seed u
rng-free ( rng -- )
Free the random generator from the heap

Random generator words

rng-seed ( u rng -- )
Initialise the generator with the seed u
rng-next-number ( rng -- n )
Calculate the next pseudo random number, 32 bit
rng-next-float ( rng -- r )
Calculate the next pseudo random float number, range [0,1>

Inspection

rng-dump ( rng -- )
Dump the random generator

Generated by fsdocgen 0.1.0