我刚刚尝试了:
此外,包括
print(math.random(999999999999))
,它打印出了1
。此外,包括
999999999999
的任何math.random()
都会打印出同样的东西。下面是一些例子:
print(math.random(1.999999999999))
» 1
print(math.random(1999999999999))
» 1
for k,v in next,{math.random(999999999999), math.random(1999999999999), math.random(2.999999999999)} do
print(v)
end
» 1
local n = math.random(999999999999)
print(n==1)
» true
如果您熟悉Lua,那么我想您已经理解了。您能为我解释一下吗?
@编辑:
我使用的Lua版本是5.2。
我还尝试过print(math.random(-999999999999))
,它打印出了111711452
。看起来它作为正数工作。
print(math.random(999999999999))
在Lua在线演示中可以正常工作。您使用的是哪个版本的Lua? - lhf