Suppose I have a loop where I generate samples with a stochastic function:
sample = stochastic_function(deterministic_parameters...)
I need to save the state in order to be able to do some calculations later. That is, I need to be able to pass in the same deterministic parameters and get the same exact sample. What is the appropriate idiom in Julia for achieving this goal?
One possible idiom:
# save parameters and the seed
I don’t really understand what you need, but there is copy for
MersenneTwister. For example
r = copy(GLOBAL_RNG); rand ()...; copy!(GLOBAL_RNG, r).
Thank you all, I am just saving the setting the seed inside of the loop and saving it for now.