• math.random but with letters
    4 replies, posted
I'm looking to have something like math.random but with letters.
[lua]function RandomLetter() return table.Random({"a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"}) end[/lua]
Store the letters in a table, and use table.Random? Edit: Late :(
[lua] function RandomLetter() return string.char(math.random(97, 122)); end [/lua]
[lua] function string.random(length) local str = ""; for i = 1, length do str = str..string.char(math.random(32, 126)); end return str; end [/lua] Very old function I found in my old dev folder, returns alpha numeric string, lower and uppercase also special chars.
Sorry, you need to Log In to post a reply to this thread.