Fix table.shuffle off-by-one error

This commit is contained in:
Lars Mueller 2021-08-30 23:02:01 +02:00
parent c13f21c444
commit 022cd1a78e

@ -34,7 +34,7 @@ end
-- Fisher-Yates -- Fisher-Yates
function shuffle(table) function shuffle(table)
for index = 1, #table - 1 do for index = 1, #table - 1 do
local index_2 = math.random(index + 1, #table) local index_2 = math.random(index, #table)
table[index], table[index_2] = table[index_2], table[index] table[index], table[index_2] = table[index_2], table[index]
end end
return table return table