Lol, just realized why it failed, math.random() with no arguments creates a float…a float between 0 and 1.
You tried to seed it for a number, not between 0 and 1.

[lua]function math.RandomSequence(length, min, max)
local length = length or 1 – Set the length to 1 if no arguments have been passed.
local sequence = {} – Create the table to hold the sequence.
local index = 0 – Set the position index to 0.
for i = 1, length do – Generate the random sequence.
if min then
if max then
sequence[ i ] = math.random(min, max)
else
sequence[ i ] = math.random(min)
end
end
end
return function()
index = index%length + 1 – Increase the index by 1, wrapping it if it exceeds length.
return sequence[ index ] – Return the next number in the sequence.
end
end[/lua]

math.RandomSequence(length, min, max) generates a random sequence that is length long and returns a function, that when called will return the next number in that sequence. When it reaches the end of the sequence, It will start from the beginning again repeating the same sequence. The sequence will contain integers between min and max, if you pass only the min argument to the function the sequence will contain integers from 1 to min.

Example:

[lua]local sequence = math.RandomSequence(12, 1000) – Generate a random sequence from 1 to 1000 that is 12 long.
for i=1, 50 do – Loop 50 times
print(sequence()) – Print the next number in the sequence.
end[/lua]

That wouldn’t work for what I’m doing. The length is unknown until the server side code figures out how many times a while loop ran. Then the client side needs to generate the same random numbers the server side did.

Using math.randomseed should be able to do this however it seems to be broken in gmod since examples from lua tutorial sites don’t work in gmod.