Random (open)

Get a random number

Syntax

// Core function, no LOADLIB necessary

INTEGER FUNCTION Random(INTEGER min, INTEGER max)

Parameters

INTEGER min

Minimum returned value

INTEGER max

Maximum returned value

Return value

INTEGER

A random value in the specified range

Description

This value returns a random number within the specified range. The size of the range (max-min) may not be larger than 65000. If the randomizer has not been seeded yet, it will automatically be seeded using the current clock value. This is a simple pseudo-random number generator, which is useful for getting simple random numbers but should not be used for cryptographic or security purposes.

Examples

//Returns a simulation of a throw with two dices
INTEGER dice1 := Random(1,6);
INTEGER dice2 := Random(1,6);
INTEGER twodice := dice1 + dice2;