random_string = function(n) -- generate a random string of length n local result = {} local nchars = #Random_string_chars for i=1,n do local idx = math.random(1, nchars) table.insert(result, Random_string_chars:sub(idx, idx)) end return table.concat(result) end