Generates a pseudo-random number. Alias for the standard library function math.random.


See also Lua library functions.

Signature:

randomNum = random([m [, n]])

Arguments:

  • m - First limit for randomly generated numbers (number)
  • n - Second limit for randomly generated numbers (number)

Returns:

  • randomNum - If called without arguments, a uniform pseudo-random real number in the range [0,1); if m is specified, a uniform pseudo-random integer in the range [1,m]; if both m and n are specified, a uniform pseudo-random integer in the range [m,n] (number)
This function is defined in the Lua standard libraries