function copy(tab)
local ret = {}
for _,v in pairs(tab) do
table.insert(ret, v)
end
return ret
end
math.randomseed(os.time())
local based_array = {1, 2, 3, 4, 5}
local used = copy(based_array)
function __sort(tab)
local i= math.random(#tab)
local selected = tab[i]
table.remove(tab, i)
tab = copy(tab)
if type(tab) ~= "table" then
tab = copy(based_array)
end
return selected
end
for i=1, #used do
print(__sort(used))
end