rand

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

rand([algorithm]) → returns Numeric

rand Argument Reference

algorithm
Default: CFMX_COMPAT

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

Examples sample code invoking the rand function


simple example Using rand()

To generate a random number between 0 to 1

writeOutput( rand() );

simple example Using rand() with algorithm

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

writeOutput( rand('CFMX_COMPAT') );

Fork me on GitHub