Given a random object with a seed that’s taken from the server, can that random object be expected to yield identical results to the server on any device or do I have to implement my own generator for this? I can’t find any guarantees for it on the API documentation.
Expected behaviour:
-- server
local seed = (tick() * 1e+5) // 1
ReplicatedStorage.GenerateLevel:FireAllClients(seed)
local rng = Random.new(seed)
for _ = 1, 5 do
print(rng:NextInteger(1, 10)) --let's assume this prints 7, 2, 5, 1, 8
end
-- client
ReplicatedStorage.GenerateLevel.OnClientEvent:Connect(function(seed:number): ()
local rng = Random.new(seed)
for _ = 1, 5 do
--this also needs to print 7, 2, 5, 1, 8 regardless of platform/device/whatever
print(rng:NextInteger(1, 10))
end
end)