mirror of
https://github.com/appgurueu/modlib.git
synced 2024-11-26 01:03:46 +01:00
Fix table.shuffle off-by-one error
This commit is contained in:
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
|
||||||
|
Loading…
Reference in New Issue
Block a user