I generally do my strict randoms like so. Not sure if it’s the perfect way though…
[lua]
–< Seed random
math.randomseed( os.time() )
–< Localize math.random
local mRan = math.random
–< Create the base table
local baseTable = { “scene1”, “scene2”, “scene3”, “scene4”, “scene5” }
–< Init final mixed table
local mixedTable = {}
–< Do work
for i=#baseTable, 1, -1 do
--< Get a random position
local tmpRan = mRan( #baseTable )
--< Get the table value at position
local tblVal = baseTable[tmpRan]
--< Insert value in mixedTable
table.insert( mixedTable, tblVal )
--< Remove value from base table, to stop duplicates
table.remove( baseTable, tmpRan )
end
–< Print out mixedTable
for j=1, #mixedTable do
print( mixedTable[j] )
end
[/lua]
And if you want to add the results…
[lua]table.insert( mixedTable, “results.lua” )[/lua]
But it would probably be better to just look for the end of your scene table and deal with it then.
Cheers.