Previous Topic: ProductNext Topic: Right Justify


Random Number

The random number function returns a pseudo-random number based on a seed numeric value.The returned random number is greater than zero and less than one, and has a length of nine decimal places.

We suggest you define the seed value with a picture of 9(9) and that you move the result of the function to a variable with a picture of V9(9).

Syntax:

►►─┬─ RAN ───────────┬─ (random-number-seed) ─────────────────────────────────►◄
   ├─ @RAND ─────────┤
   ├─ RANDOM ────────┤
   └─ RANDOM-NUMBER ─┘

Invocation names:

RAN
@RAND
RANDOM
RANDOM-NUMBER

Parameters:

(random-number-seed)

Specifies the numeric variable data field that contains the seed value from which the pseudo-random number is calculated. Random-number-seed cannot be zero.

Example:

This example calculates a random number from the seed value of 13549:

compute 'number' = random (13549)

  NUMBER = 0.627847111