1

Why do I get the same randomized numbers from my previous run when I run again this code:

local weightsOutput = {}
for i=0, 2 do        --initialize random weights
     weightsOutput[i] = string.format("%0.4f",(2*math.random())-1)
     print(weightsOutput[i])
end

any problem with my code? By the way, I'm using LUA.

4

1 回答 1

3

开始你的程序

math.randomseed( os.time() )
于 2013-04-21T15:54:55.240 回答