Module:ShuffleArray
From Blaseball Wiki
function shuffle(array)
math.randomseed(mw.site.stats.edits + mw.site.stats.pages + os.time() + math.floor(os.clock() * 1000000000))
-- fisher-yates local output = { } local random = math.random
for index = 1, #array do local offset = index - 1 local value = array[index] local randomIndex = offset*random() local flooredIndex = randomIndex - randomIndex%1
if flooredIndex == offset then output[#output + 1] = value else output[#output + 1] = output[flooredIndex + 1] output[flooredIndex + 1] = value end end
return output
end
return shuffle