Advertisement
Billy123456

Random String Generator

Oct 7th, 2017
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.50 KB | None | 0 0
  1. local function GetRandomCharacter()
  2.     return string.char(math.random(1, 122))
  3. end
  4.  
  5. local num = 1234567 --any number
  6. local temp = {}
  7.  
  8. for letter = 1, #tostring(num) do --converts to table
  9.     table.insert(temp, string.sub(tostring(num), letter, letter))
  10. end
  11.  
  12. for _ = 1, #temp * 2 / 1.5 do --makes and scrambles numbers and characters
  13.     table.insert(temp, math.random(1, #temp), GetRandomCharacter())
  14. end
  15.  
  16. local randomness = ''
  17. for _, letter in pairs(temp) do
  18.     randomness = randomness..letter
  19. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement