rng - Pseudo random number generator module

Module Description

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

Module Words

Generator structure

rng% ( - n )
Get the required space for the rng data structure

Random generator structure creation, initialisation and destruction

rng-init ( u:seed w:rng - )
Initialise the rng structure with a seed

rng-create ( u:seed "name" - )
Create a named random generator in the dictionary

rng-new ( u:seed - w:rng )
Create a new random generator on the heap

rng-free ( w:rng - )
Free the random generator from the heap

Random generator words

rng-seed ( u:seed w:rng - )
Initialise the generator with a seed value

rng-next-number ( w:rng - n )
Calculate the next pseudo random number [32 bit]

rng-next-float ( w:rng - r )
Calculate the next pseudo random float [0,1>

Inspection

rng-dump ( w:rng - )
Dump the random generator structure


generated 09-Jan-2007 by ofcfrth-0.2.0