RANDOM Function

Material prepared from M Programming Book [WALTERS1997]

Page 49.

Command

$RANDOM(limit)

Description

$RANDOM(limit) takes an interger >= 1 as an argument and returns a psuedorandom integer [0, limit).

  • If limit < 1 then the error RANDARGNEG is thrown.

Example

; Writes a random number [0, 10)
S X=$RANDOM(10) W X