Documentation

random

Syntax: %random(min,max)

return a random integer >= min and <= max. If max is omitted, then min specifies the maximum value, and 0 is used as the minimum value. If %random is used without any arguments, it returns a random integer between 0 and 99 (inclusive).

Examples:

#VAR dirList {n|e|s|w|ne|se|sw|nw|u|d}
#20 {%item(@dirList,%random(5,8
))}
sends 20 randomized diagonal directions to the mud.
#VAR dType 12
#VAR dNum 6
#VAR dOffset 22
#VAR sum @dOffset
#LOOP @dNUM {#ADD sum %random(1,@dType)}
#SAY @sum
displays the sum of 6 rolls with a 12-sided die plus an offset of 22
Note: The 'short version' of this example is
#SAY %dice(6d12+22)

Add comment

Login or register to post comments