So there are a couple of interesting observations that can be made
here.
The first one is born from personal experience, never depend on the
GLOBAL_RNG. You can never know when some other piece of code will
sneak in and take several random numbers from your random stream.
This was a bigger issue awhile ago when many of the functions in
Distributions did not take an rng argument and they all used the
GLOBAL_RNG.
So having said that, you should always provide an rng, your rng,
to any function that needs one. If it means rewriting code, so
be it, it is just best practice.
However, your question about getting back to a known state that
may not have been the result of a (re)seeding operation is a good one.
The answer is that you can simply copy the rng.
my_rng = MersenneTwister(1)
rand(my_rng, ...)
# sample others dists using my_rng
Now you want to save the state at some point
cached_rng = copy(my_rng)
# continue on with current random stream
rand(my_rng, ...)
Now you want to go back to a saved state
new_rng = copy(cached_rng)
rand(new_rng, ...)
The other thing is that is it much faster to copy a cached
MersenneTwister object than it is to reseed (even if you know it) to
and known seed.
Finally, if you really, really want to change the GLOBAL_RNG, (I can
already see the Villagers with torches coming for me…) you can do
(No guarantees/warantees…)
import Random
mrng = Ransom.MersenneTwister(2718)
Random.eval(:(GLOBAL_RNG = $mrng))