Random

Category: Arithmetics
Since engine version: 1.0 OC

Description

Yields a random number from 0 to max-1.

Syntax

int Random(int max);

Parameter

max:
Maximum value. Must be zero or greater. The bevaviour for negative values is undefined.

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, 2002-06