Lua随机数

来源:互联网 发布:汇编语言与c语言区别 编辑:程序博客网 时间:2024/05/17 19:17

产生随机数

math.randomseed(os.time())num=math.random(10)print(num)


math.randomseed(os.time())while (true) dotimenow=os.time()if timenow~=lasttime thenprint("时间--"..os.time().."随机数"..math.random(10))endlasttime=timenowend


random(n)产生[1-n]之间的随机数










0 0