Corona table.sort()
snippet in lua

Corona table.sort()

user312

function shuffled(tab)
    local n, order, res = #tab, {}, {}
    for i=1,n do order[i] = { rnd = math.random(), idx = i } end
    table.sort(order, function(a,b) return a.rnd < b.rnd end)
    for i=1,n do res[i] = tab[order[i].idx] end
    return res
end