lua取随机数

do
	local a = string.reverse(os.time())
	print(a)
	math.randomseed(a)
	-- math.randomseed(os.time())
	for i=1,30 do
		local b = math.random(1,100)
	  	print(b)
	end
end


lua取随机数,如果randomseed()函数设置的种子一样的,随机出来的也是一样的。网上答案说种子比较大,但是实际测试了一下,也是一样的,难道是我写错了吗?

原文地址:https://www.cnblogs.com/mentalidade/p/6546060.html