Different seeds returning the same numbers?

I’m making a system that loads thousands of cities onto a globe of the Earth, kinda like in Rise of Nations.

I want to make the countries have a set color for cities, instead of just one city color over the entire globe, so I came up with a system that converts the letters to numbers

Code
local lettersConversionList = {
	["a"] = 1,
	["b"] = 2,
	["c"] = 3,
	["d"] = 4,
	["e"] = 5,
	["f"] = 6,
	["g"] = 7,
	["h"] = 8,
	["i"] = 9,
	["j"] = 10,
	["k"] = 11,
	["l"] = 12,
	["m"] = 13,
	["n"] = 14,
	["o"] = 15,
	["p"] = 16,
	["q"] = 17,
	["r"] = 18,
	["s"] = 19,
	["t"] = 20,
	["u"] = 21,
	["v"] = 22,
	["w"] = 23,
	["x"] = 24,
	["y"] = 25,
	["z"] = 26,
	["'"] = 27,
	[" "] = 28,
	["("] = 29,
	[")"] = 30,
	["-"] = 31,
	[","] = 32
}

local seed = ""
for _,letter in pairs(string.split(city[4],"")) do -- city[4] is a string of the country's name.
	seed ..= lettersConversionList[string.lower(letter)]
end
seed = tonumber(seed) -- I put this line here because math.randomseed(tonumber(seed)) said there was an error when there wasn't, for some reason.
math.randomseed(seed)

local cityColorVal = Color3.fromHSV(math.random(0,360), math.random(100,255), math.random(100,255))

The issue is though, despite different countries giving different seeds, countries are appearing as the exact same RGB values. Am I doing the color generation wrong or something?
Maybe it’s too big of numbers for math.randomseed?

By the way, all countries that do have different colors have it working properly. Any cities that are the wrong color in a properly colored country are actually a small country inside of the larger country.

Ex:

These cities in Italy are different cause they’re not technically in Italy, but all actual Italian cities are colored properly.

I am getting no errors, and I did check, every seed is different as far as this checking system is concerned:

if not seeds[seed] then
	seeds[seed] = city[4]
else
	if city[4] ~= seeds[seed] then
		print("seed repeated")
	end
end

math.randomseed is just some “id” that is generated numbers from, each seed has a big chance (like really big) to result in the same number of some math.random(min,max) when the range is too low, maybe change the letterConversionList values with different number rather than just counting from 1 to 32

math.randomseed changes the global seed used by all calls to math.random. If you want to assign individual seeds to objects, construct a Random object and use the seed argument. Random allows you to hold a seed that’s local to that Random object.

1 Like

I’ll try this and let you know what happens, thank you.

Update: I tried making the numbers different and I now think that it’s because the seeds are too big, because all the seeds are now big numbers and it results in the same color. I’m going to try something different with the encoding of country names to seeds.

I’m changing the global seed each time, though, so it shouldn’t be an issue. Still, I’m going to switch to using the seed argument, anyway, I didn’t even know that existed…