Guest User

Untitled

a guest
Jun 19th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. local charset = {}
  2.  
  3. -- qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM1234567890
  4. for i = 48, 57 do table.insert(charset, string.char(i)) end
  5. for i = 65, 90 do table.insert(charset, string.char(i)) end
  6. for i = 97, 122 do table.insert(charset, string.char(i)) end
  7.  
  8. function string.random(length)
  9. math.randomseed(os.time())
  10.  
  11. if length > 0 then
  12. return string.random(length - 1) .. charset[math.random(1, #charset)]
  13. else
  14. return ""
  15. end
  16. end
Add Comment
Please, Sign In to add comment