I’m not sure if it’s easy to do (or possible?), because each thread now has its own seed (you likely would need to suspend them all to do this, for some worst-case scenario, is it possible?). If you know you do not threading then something is likely possible. Or even with threading you can always opt into using the old MersenneTwister RNG (and lose out on threaded RNG and its speedup) and then your old method should be workable (and the RNG is only global). You must be sure all your code is changed to use the old RNG, and not some place left out using the new one (you can use both, that’s not the problem, only for what you’re trying to do).
I could run have every thread store its PRNG and then load them back up, but that doesn’t resolve the issue with copy! (I’ve updated the OP to clarify).
After reading up on things, it is my understanding that each Task inherits a PRNG from its parent and subsequently modifies the parent. I’m saving and re-entering on the top task of my problem, so I think it is safe to do
using JLD2
using Random
myRNG = jldopen(File,"r") do F
F["RNG"]
end
S = Xoshiro()
copy!(S, myRNG)
copy!(default_rng(), S)
This solution doesn’t throw any errors as of yet, but I’m also not sure whether it has the intended feature of “reproducibility”.