API random

From Wowpedia
Jump to: navigation, search

Returns a random number within the specified interval.

rand = math.random([ [low, ] high])
rand = random([ [low, ] high])

Arguments

low 
Number - lower integer limit on the returned random value.
high 
Number - upper integer limit on the returned random value.

Returns

rand 
Number - Generated random value. If no arguments were specified, the value is a uniformly-distributed decimal between 0 (inclusive) and 1 (exclusive). Otherwise, returns a uniformly-distributed integer between low (1 if not specified) and high, both bounds inclusive.

See also

Patch history

Mists of Pandaria Patch 5.4.2 (2013-12-10): The random and math.random functions now use the securerandom RNG added in 5.4.0. The standard library-derived random number generator is available as fastrandom.