I am currently trying to create a primitive procedural generation script with Math.Random(). It seems to have a few bugs, and I am at a loss of what to do. My current code is this:
function GenerateRandom (seed,max)
local store = {}
for i = 1, max/5 do
math.randomseed(seed)
for b = 1, 5 do
store[(i-1)*5 + b] = math.ceil(math.random() * 100000000000000)
seed = math.random() * 100000000000000
end
print(seed)
end
return store
end
local list = GenerateRandom(os.time(),100)
When I run it, it should theoretically generate new numbers every time, because I am setting a new seed every time it generates a number. However, this is not the case, and it seems to generate a repeating set. This should not be the case. I am wondering if anyone can point out any issues with my code. Any help would be appreciated!
This seems to be the answer. Math.randomSeed() doesn’t correctly set the seed in Roblox. Random.new() actually works. I actually was using code that I built on a separate platform (lua somewhere else), which may be why Roblox doesn’t run the code properly.