Random

Category: Arithmetics
Since engine version: 4.6.5.0 CP

Description

Yields a random number from 0 to iMaxVal-1. The returned value cannot be greater than 32767, however.

Syntax

int Random (int iMaxVal);

Parameter

iMaxVal:
Maximum value

Example

protected func Hit()
{
  if(!Random(60)) Explode(Random(10)+1);
}
        
Explodes the object with a probability of 1:60. The explosion radius is a random value from 1 to 10.
See also: RandomX
jwk, Juni 2002