User Tools

Site Tools


random_return_random_number_.htm
Navigation:  Language Reference > 13 - Built-in Functions >====== RANDOM (return random number) ====== Previous pageReturn to chapter overviewNext page

RANDOM(low,high)

blk2blue.jpg

RANDOM Returns random integer.
low A numeric constant, variable, or expression for the lower boundary of the range.
high A numeric constant, variable, or expression for the upper boundary of the range.

The RANDOM procedure returns a random integer between the low and high values, inclusively. The low and high parameters may be any numeric expression, but only their integer portion is used for the inclusive range.

Return Data Type:     LONG

Example:

Num                BYTE,DIM(49)

LottoNbr           BYTE,DIM(6)

CODE

CLEAR(Num)

CLEAR(LottoNbr)

LOOP X# = 1 TO 6

 LottoNbr[X#] = RANDOM(1,49)    !Pick numbers for Lotto

 IF NOT Num[LottoNbr[X#]]

  Num[LottoNbr[X#]] = 1

 ELSE

  X# -= 1

 END

END

random_return_random_number_.htm.txt · Last modified: 2021/04/15 15:57 (external edit)