math.random([n [,m]])
文档原版:
this function is an interface to the simple pseudo-random generator function rand
provided by ANSI C. (No guarantees can be given for its statistical properties.)
When called without arguments, returns a pseudo-random real number in the range [0,1).
When called with a number m
, math.random
returns a pseudo-random integer in the range [1, m].
When called with two numbers m
and n
, math.random
returns a pseudo-random integer in the range [m, n].
翻译:
用法:1.无参调用,产生[0, 1)之间的浮点随机数。
2.一个参数n,产生[1, n]之间的整数。
3.两个参数,产生[n, m]之间的整数