Merge pull request #22 from DUznanski/shuffle-fix

Fix shuffle to avoid bias
This commit is contained in:
Max Cahill 2021-05-21 09:14:01 +10:00 committed by GitHub
commit c1a4e6898a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -173,7 +173,7 @@ end
--shuffle the order of a table
function tablex.shuffle(t, r)
for i = 1, #t do
local j = _random(1, #t, r)
local j = _random(i, #t, r)
t[i], t[j] = t[j], t[i]
end
return t