RandRange()

Generates a random integer between two specified numbers.

Requests for random integers that are greater than 100,000,000 result in non-random numbers, to prevent overflow during internal computations.

RandRange( number1=number, number2=number, algorithm=string );

Returns: Number

Argument Description
number1
number, required

smaller number

number2
number, required

bigger number

algorithm
string, optional

The algorithm to use to generate the random number.

  • CFMX_COMPAT (very simple and not very secure algorithm (default)).
  • SHA1PRNG (generates a number using the Sun Java SHA1PRNG algorithm. This algorithm provides greater randomness than the default algorithm)
  • IBMSecureRandom (IBM JVM does not support the SHA1PRNG algorithm)

Examples

writeDump(randRange(25,125,'CFMX_COMPAT'));
writeDump(randRange(100,500,'SHA1PRNG'));

See also