How would I go about generating a random 5 letter string?

I’m trying to store the PlaceID of a place in a randomly generated string, But i dont know how to generate the random 5 letters in the first place.can someone tell me how to do this?

If you want to generate random letters this is a method:

local Build = ''
local Alphabet = {'a', 'b', 'c'} --Place all the alphabet here


for letter = 1, 5 do
       local Random = math.random(1, #Alphabet) --choose a random number 

       Build = Build..Alphabet[Random] --Adds the Alphabet Index to string 
end

--Basically 'Build' are the random letters 

PD: Idk if this is the BEST method, also im in phone

local alphabet = {}
local randString = ""

for i=97, 122 do
	local char = utf8.char(i)
	table.insert(alphabet, char)
end

for i=1, 5 do
	local rand = math.random(1, #alphabet)
	randString = randString..alphabet[rand]
	if i == 5 then
		print(randString)
	end
end
3 Likes

Thank you, works as intended. I do not understand the utf8, but i’ll do some research on it, thanks!