Requirements: a table in order to disrupt the order of discharge
Note: This function will modify the original data off the table, because the table is in lua pass references
function Table_Rand(t)
if t == nil then
return
end
local tRet = {}
local Total = table.getn(t)
while Total > 0 do
local i = math.random(1,Total)
table.insert(tRet,t[i])
t[i] = t[Total]
Total = Total -1
end
return tRet
end