Moduł:Shuffle

Z Nonsensopedii, polskiej encyklopedii humoru

local p = {}

local function shuffleArr(t)
  local n = #t
  while n > 2 do
    local k = math.random(n)
    t[n], t[k] = t[k], t[n]
    n = n - 1
 end
 return t
end

function p.shuffle(frame)
	t = shuffleArr(frame:getParent().args)
	s = ""
	for i=1, #t do
		s = s .. t[i] .. "\n"
	end
	
    return s   
end

return p