Module:Generic Random Picker

function returner(numb,table) local max = #table local toreturn = tonumber(numb) % max if toreturn == 0 then toreturn = max end return table[toreturn] end

function RandomPicking(table) local rett = { } function rett.main(frame) return returner(frame.args[1],table) end function rett.rand(frame) math.randomseed(os.time) return returner(math.rand(#table),table) end function rett.loop(frame) local temp = os.date("*t") return returner(temp.yday,table) end return rett end

tbl = { "1", "2", "3" } print(RandomPicking(tbl).loop )