FT_RAND1()
Generate a random number
──────────────────────────────────────────────────────────────────────────────

Syntax

FT_RAND1( <nMax> ) -> nRand

Arguments

<nMax> Maximum limit of value to be produced.

Returns

nRand is a random number between 0 (inclusive) and <nMax> (exclusive).

Description

Generates a non-integer random number based on the Linear
Congruential Method.

If you need a random number between 1 and <nMax> inclusive, INT()
the result and add 1.

If you need a random number between 0 and <nMax> inclusive,
then you should ROUND() the result.

Examples

nResult := INT( FT_RAND1(100) ) + 1 // 1 <= nResult <= 100
nResult := ROUND( FT_RAND1(100), 0 ) // 0 <= nResult <= 100
nResult := FT_RAND1( 1 ) // 0 <= nResult < 1

Source: RAND1.PRG

Author: Gary Baren