How to randomize tables?

How would I randomize this?

So it would pick one timer every say 1 second?

timerTable = { rightenemytimer=timer.performWithDelay(1000,spawnRightenemy,0), plusDOODtimer=timer.performWithDelay(500,spawnPLUSdood,0) }

@Max,

Sorry, but you’ve created a table of handles to timer events, not timers.  Try this:

-- Table containing reference to spanwner (they must be defined before this) local spawnFunc = { spawnRightenemy, spawnPLUSdood ) -- Variable to hold last timer handle local lastTimer -- Forward declare random spawn function local randomSpawner -- Function to randomly choose one of two functions and execute it. randomSpawner = function() local num = math.random(1,2) spawnFunc[num]() -- Call spawner again in 1 second lastTimer = timer.performWithDelay( 1000, randomSpawner ) end -- Handy canceller local function cancelSpawner() if(lastTimer)then timer.cancel(lastTimer) end lastTimer = nil end ... later randomSpawner() timer.performWithDelay(10000, cancelSpawner )

@Max,

Sorry, but you’ve created a table of handles to timer events, not timers.  Try this:

-- Table containing reference to spanwner (they must be defined before this) local spawnFunc = { spawnRightenemy, spawnPLUSdood ) -- Variable to hold last timer handle local lastTimer -- Forward declare random spawn function local randomSpawner -- Function to randomly choose one of two functions and execute it. randomSpawner = function() local num = math.random(1,2) spawnFunc[num]() -- Call spawner again in 1 second lastTimer = timer.performWithDelay( 1000, randomSpawner ) end -- Handy canceller local function cancelSpawner() if(lastTimer)then timer.cancel(lastTimer) end lastTimer = nil end ... later randomSpawner() timer.performWithDelay(10000, cancelSpawner )