数学函数库
print("绝对值")
print(math.abs(-1))
print("最大值")
print(math.max(2,5,1,7,4))
print("最小值")
print(math.min(2,5,1,7,4))
print("sin")
print(math.sin(0))
print("cos")
print(math.cos(0))
print("平方根")
print(math.sqrt(64))
print("随机数")
math.randomseed(50000)
print(math.random(1,10))
--->
绝对值
1
最大值
7
最小值
1
sin
0
cos
1
平方根
8
随机数
10
操作系统库(时间)
print(os.date())
print(os.time())
--->
06/09/20 10:23:59
1591669439
自定义随机函数
function GetTrueRandom(min,max)
local strTime = tostring(os.time())
local strRev = string.reverse(strTime)
local strRandomTime = string.sub(strRev,1,6)
math.randomseed(strRandomTime)
return math.random(min,max)
end
print(GetTrueRandom(1,100))