rand

Generates a pseudo-random number in the range 0 - 1.

rand([algorithm]) → returns numeric

rand Argument Reference

algorithm string
Default: CFMX_COMPAT

The algorithm to use to generated the random number.
Values:
  • CFMX_COMPAT
  • SHA1PRNG
  • IBMSecureRandom

Examples sample code invoking the rand function

To generate a random number between 0 to 1

writeOutput( rand() );

To generate a random number between 0 to 1 by using CFMX_COMPAT algorithm

writeOutput( rand('CFMX_COMPAT') );

Fork me on GitHub