Module random - Random number generation

Random number generation.

Index

Declarations

random.occ:30Function random.init

RANDOM.STATE FUNCTION random.init (VAL INT32 seed)

Initialise RNG state given (up to) 32 bits of initial entropy.

random.occ:36Function random.get

INT32, RANDOM.STATE FUNCTION random.get (VAL RANDOM.STATE state)

Generate 32 bits of random data. Returns the data and a new RNG state.

random.occ:64Process random.init.from.time

PROC random.init.from.time (RESULT RANDOM.STATE state)

Initialise an RNG using the current time as initial entropy.

random.occ:75Function random.split

RANDOM.STATE, RANDOM.STATE FUNCTION random.split (VAL RANDOM.STATE state)

Given an RNG state, compute two new states deterministically from it that have a low probability of generating overlapping sequences.

random.occ:94Function random.int

INT, RANDOM.STATE FUNCTION random.int (VAL INT max, VAL RANDOM.STATE state)

Generate a random INT.

Parameters:

VAL INT max Upper limit
VAL RANDOM.STATE state Current RNG state

Returns:

INT Output value, uniformly distributed in the range [0, max).
RANDOM.STATE New RNG state

random.occ:112Function random.real32

REAL32, RANDOM.STATE FUNCTION random.real32 (VAL REAL32 max, VAL RANDOM.STATE state)

Generate a random REAL32.

Parameters:

VAL REAL32 max Upper limit
VAL RANDOM.STATE state Current RNG state

Returns:

REAL32 Output value, uniformly distributed in the range [0, max).
RANDOM.STATE New RNG state

random.occ:133Function random.gaussian.real32s

REAL32, REAL32, RANDOM.STATE FUNCTION random.gaussian.real32s (VAL RANDOM.STATE state)

Generate two random REAL32s from a Gaussian distribution.

This function exists because the Box-Muller transform used to generate Gaussian-distributed numbers in this module produces two results at a time.

Parameters:

VAL RANDOM.STATE state Current RNG state

Returns:

REAL32 value1, value2 Two output values from a Gaussian distribution with mean 0.0 and standard deviation 1.0
RANDOM.STATE new.state New RNG state

random.occ:171Function random.gaussian.real32

REAL32, RANDOM.STATE FUNCTION random.gaussian.real32 (VAL RANDOM.STATE state)

Generate a random REAL32 from a Gaussian distribution.

Parameters:

VAL RANDOM.STATE state Current RNG state

Returns:

REAL32 value Output value from a Gaussian distribution with mean 0.0 and standard deviation 1.0
RANDOM.STATE new.state New RNG state

random.inc:25Record RANDOM.STATE

DATA TYPE RANDOM.STATE

The internal state of the random number generator.