Usually the first random values โโare not truly random (but in any case they are never really random, it is a pseudo random number generator). Install randomseed first, then randomly generate it several times. Try this code, for example:
math.randomseed( os.time() ) math.random() math.random() math.random() for i = 1, 1000 do j = math.random(i, row-one) u[i], u[j] = u[j], u[i] for k = 1, 11 do file:write(input2[u[i]][k], " ") end file:write"\n" end
However, you can try this from http://lua-users.org/wiki/MathLibraryTutorial :
-- improving the built-in pseudorandom generator do local oldrandom = math.random local randomtable math.random = function () if randomtable == nil then randomtable = {} for i = 1, 97 do randomtable[i] = oldrandom() end end local x = oldrandom() local i = 1 + math.floor(97*x) x, randomtable[i] = randomtable[i], x return x end end
source share