— When called without arguments, returns a pseudo-random float with uniform
— distribution in the range [0,1). When called with two integers m
and
— n
, math.random
returns a pseudo-random integer with uniform distribution
— in the range [m, n]. The call math.random(n)
is equivalent to math.random
(1,n).
—@overload fun():number
—@param m number
—@param n number
—@return number
function math.random(m, n) end
无参调用返回[0,1)之间的浮点型
有参调用返回的是整数,所以参数预期也是整数
参数可以是负数,但是需要在lua能表示的区间内。
m-n为非负数
最后
以上就是精明巨人最近收集整理的关于Lua.math.random的全部内容,更多相关Lua内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复