Moduł:Shuffle

Z Nonsensopedii, polskiej encyklopedii humoru

local p = {}

function p.shuffle(frame)
	math.randomseed(os.time())
	local t = {}
	for _,arg in pairs(frame:getParent().args) do
		table.insert(t, arg)
	end

	local s = ""
	while #t > 0 do
    	local k = math.random(#t)
    	s = s .. table.remove(t, k) .. "\n"
	end
	
    return s   
end

return p