Для этого можно написать функцию на чистом lua:
local charset = "abcdefghijklmnopqrstuvwxyz1234567890"
function string.random(length)
if length > 0 then
return string.random(length - 1) .. charset:sub(math.random(1, #charset), 1)
else
return ""
end
end
print (string.random(10))
В engine есть встроенная функция random_string, которая входит в пакет utils.