|
@@ -112,8 +112,9 @@ end
|
|
|
|
|
|
-- Randomize the order of a the elements in a table list
|
|
-- Randomize the order of a the elements in a table list
|
|
local function scramble(t)
|
|
local function scramble(t)
|
|
- for i=1, #t do
|
|
|
|
- t = swap(t, i, math.random(#t))
|
|
|
|
|
|
+ local n = #t
|
|
|
|
+ for i = 1, n - 1 do
|
|
|
|
+ t = swap(t, i, math.random(i, n))
|
|
end
|
|
end
|
|
return t
|
|
return t
|
|
end
|
|
end
|