FANDOM


local sub = string.sub
local lower = string.lower
local upper = string.upper
local random = math.random
 
return {
    main = function(frame)
        local s0 = frame.args[1]
        local s1 = {}
 
        local wikiLinkToken = 0
 
        -- Set randomseed
        math.randomseed( os.time() )
        random()
 
        for i=1,#s0 do
            local c = sub(s0,i,i)
            if wikiLinkToken == 2 then
                -- Full wikilink start token reached
                wikiLinkToken = c == "|" and 0 or 2
                s1[i] = c
            elseif c == "[" then
                -- Reached part of wikilink start token
                wikiLinkToken = wikiLinkToken + 1
                s1[i] = "["
            else
                -- rAnDoMIzE CApS
                wikiLinkToken = 0
                s1[i] = (random() > 0.5 and lower or upper)(c)
            end
        end
 
        return table.concat(s1)
    end
}
Community content is available under CC-BY-SA unless otherwise noted.