Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local function shuffleTable(t)
- local temp = {}
- local alreadyChosen = {}
- for i = 1, #t do
- local v = true
- local r = math.random(1, #t)
- while v do
- local found = false
- for _, v in ipairs(alreadyChosen) do
- if r == v then
- found = true
- end
- end
- if not found then
- table.insert(alreadyChosen, r)
- temp[r] = t[i]
- v = false
- end
- r = math.random(1, #t)
- end
- end
- return temp
- end
Advertisement
Add Comment
Please, Sign In to add comment