Random strings in Lua
July 28, 2022 ยท View on GitHub
math.randomseed(os.time())
local charset = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890"
function string.random(length) if length > 0 then return string.random(length - 1) .. charset:sub(math.random(1, #charset), 1) else return "" end end