local read = io.read("*number") or math.random(1, 74) -- if no input then it'll give a random number
local LOOP = true

local Index = {
    n_Bar = "—",
    l_Bar = "-",
    d_Bar = ".",
    ap_Bar = "'",
    la_Bar = "<",
    ra_Bar = ">",
    ua_Bar = "^",
    p_Bar = "+",
    sc_Bar = ";",
    c_Bar = ":",
    cbl_Bar = "{",
    cbr_Bar = "}",
}

local function ConvertToArray(DICTIONARY)
    local ARRAY = {}
    
    for i, v in next, DICTIONARY do
        ARRAY[#ARRAY + 1] = v
    end

    return ARRAY
end

local function GetRANDOM(INDEX)
    local CONVERSION = ConvertToArray(INDEX)
    
    return CONVERSION[math.random(#CONVERSION)]
end

local function CreateBar(INDEX, INPUT)
    return string.rep(INDEX, INPUT)
end

local function CreateFunkyBar(INDEX, INPUT)
    return string.rep(GetRANDOM(INDEX), INPUT)
end

if LOOP then
    local time = 0
    repeat
        print(CreateFunkyBar(Index, read) .. " (" .. read .. ")")
        time = time + 1
    until time == math.random(1, 112) -- +1 = output display limit for the initial 40960 bytes
    print("MAX:", time)
else
    print(CreateFunkyBar(Index, read))
    --print("(" .. read .. ")")
end

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: