Help with syncing random values between server and client.

So I have a few random values that I need to be the same on both client and server. This is what I currently use:


function SeedDeRandom( seed )
	local sd = CurTime()
	if type( seed ) == "string" then
		local num = ""
		seed = string.sub( seed, 1, math.Clamp( string.len( seed ), 1, 15 ) ) -- make sure string is not too long
		for i = 1, string.len( seed ) do
			num = num..string.byte( seed, i, i )
		end
		sd = sd + math.log( tonumber( num )/math.pow( tonumber( num ), 2 ) )
	elseif type( seed ) == "number" then
		seed = seed / math.pow( tonumber( seed ), 2 )
		seed = math.log( seed )
		sd = sd + seed
	end

	math.randomseed( sd )
end

my current issue is it uses CurTime() to derive its random seed, and the problem with that is CurTime() is affected by precision loss after a server is up for 6 hours, I was wondering is there a better way to sync random values on the server and client?

Maybe try

util.SharedRandom. Not sure if that will work with the precision loss.

That could work, but I’m going to see if there are any other ideas. I would like to find a method that does not require me to use CurTime() and I would have to with that, because it needs a unique seed.