Module:Shuffle
See Template:Shuffle for documentation.
local p = {}
function p.transclude( frame )
local titles = {};
for i, title in ipairs( frame:getParent().args ) do
table.insert( titles, title );
end
math.randomseed( os.time() );
local output = {};
while #titles > 0 do
local title = mw.text.trim( table.remove( titles, math.random( #titles ) ) );
table.insert( output,
frame:expandTemplate{ title = title, args = {} }
);
end
return table.concat( output, '\n' )
end
return p;