Random

From ZDoom Wiki
Jump to: navigation, search

int Random (int min, int max)

Usage

Returns a random integer between min and max (inclusive).

Parameters

  • min: The minimum value to return.
  • max: The maximum value to return.

Return value

A random integer between min and max (inclusive).

Examples

This script damages the activator with damage from 1 to 10 when activated:

script 1 (void)
{
    DamageThing (Random (1, 10));
}

You can also use fixed point numbers, this script causes the activator to face a random direction:

script 1 (void)
{
    SetActorAngle (0, Random (0, 1.0));
}