I look at this as independent. We could provide a custom PRNG module - however, it won’t help people who are already using math.random() (which unfortunately is a builtin in Lua). Plus if you really want good random numbers you can just write a PRNG yourself
So ideally I’d rather fix math.randomseed first, and then if there is still demand for instance-based RNG add that. This is why I’m thinking of scripts as units of isolation - it’s pretty commonplace in ROBLOX, with globals separation etc.
The problem with option 1 is that any other script calling math.randomseed will reset your RNG state. Here’s the issue I ran into some time ago:
I had code like this:
for i=1,100 do
local npc = Zombie:Clone()
local x = (math.random() * 2 - 1) * 100
local z = (math.random() * 2 - 1) * 100
npc:SetPrimaryPartCFrame(CFrame.new(x, 10, z))
npc.Parent = workspace
end
All zombies were spawned in the same place, which took me some time to figure out. The problem was that the NPC model had a script that called math.randomseed(os.time()) in it upon startup. What happened is that every time I parented the new model to the workspace, the script ran and reset the randomseed; since os.time() value did not change between invocations since the loop is pretty fast the seed was always reset to the same number at the end of every iteration, and I got the same x/z values on every iteration.