Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Sorting a table fully random?

I am trying to make a Map system, what works, but it is too boring!

ExampleTable = {"Map1", "Map2", "Map3", "Example"}

1 answer

✓ Accepted answer

Lua doesn't have shuffle function

Here's a quick and not so bad method to shuffle tables:

function shuffle(tbl)
  for i = #tbl, 2, -1 do
    local j = math.random(i)
    tbl[i], tbl[j] = tbl[j], tbl[i]
  end
  return tbl
end

2 comments

0

This works thanks!

0

This works thanks!

This discussion is preserved as it was. New answers, comments, and votes are closed.