Hosting and domain costs until October 2024 have been generously sponsored by dumptruck_ds. Thank you!

random

From Quake Wiki

float random()

Usage[edit]

Used for generating random numbers e.g. with weapon spread.

Return[edit]

Returns a floating point value in the range [0, 1]. The fact it can return 1 is an oversight and caution should be exercised if using it for array indices.

Example[edit]

// Adds anywhere from 0 to 32 extra map units to the range
float checkRadius = 256 + 32 * random();
entity head = findradius(pos, checkRadius);