![]() |
Automated updating of API pages at this location, to reflect patch changes, has ceased from 10.1.7 onwards. |
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) andhigh, both bounds inclusive.
See also
Patch changes
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.
