Random
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));
}
This article is issued from Zdoom. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.