Recreate something globally

So I want to recreate a randomised set of data across all servers, and it has to run on every half hour.

1 Like

You want the same data to be created every server right?

1 Like

yes i want the same data on each server

You can use Random.new with a seed to ensure the same values are generated, and you must ensure you have the same seed on all servers, for this you can use the UTC UNIX time and possibly snap it to 30-minute intervals to be safe

Like:

local seconds = math.floor(DateTime.now().UnixTimestampMillis / 1000)
local minutes = math.floor(seconds / 60)
minutes -= minutes % 30
local rand = Random.new(minutes)
--Use rand like you'd need to

Not sure if I did the minute snapping part right though

1 Like

OHHHHH
wait i understand everything now. you have an encoded seed with a key across all servers tysm

1 Like

Note that constantly changing the seed of a random number generator will reduce the randomness of your samples.

Depending on the sampling frequency and sufficient choice of hash function, random numbers can be sampled by hashing the current UnixTimestamp.

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