Help with randomly generated seed system

  1. What do you want to achieve? Keep it simple and clear!
    I’d like to have a fully randomly generated seed with numbers, letters and special characters.

  2. What is the issue? Include screenshots / videos if possible!
    I’ve tried searching on the devforums already and i found solutions such as “HttpService:GenerateGUID” But that doesn’t give the exact result i’m looking for

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    As i’ve previously said, i haven’t yet found any proper solutions. I’d like to get randomly generated seeds such as " a7fn4]m`27) "

You would probably have to type out every character inside a table, then make a random number picker, probably 1 though 100 and just make the randomisation go back and fourth until you get your desired length of seed.

Here’s an example:

local function generate(length)
    local characters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()-_=+[]{};:'\",.<>?/\\|`~"
    local seed = ""
    
    for i = 1, length do
        local randomIndex = math.random(1, #characters)
        seed = seed .. string.sub(characters, randomIndex, randomIndex)
    end
    
    return seed
end

local seed1 = generate(15)
print(seed1)

It uses a “for-loop” that runs the amount of times of your length
and for each of those, it gets a position of the dataset,
and checks the value of it, then inserts it.

HttpService:GenerateGUID gives the exact result you’re looking for according to this

Yes, however it doesnt contain custom characters

This looks like the common answer so i guess i’ll use this. Thank you!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.