I would like to be able to do something like the following pseudocode:
SeedRandom[someNumber]; (* Initialize the random number generator's seed for reproducible results *)
Do
Run a batch of Monte Carlo simulations;
Obtain the current value of the seed of Mathematica's RNG;
DumpSave["filename.mx",{monteCarloResults,currentSeedValue}];
Until N batches have run
The idea here is that if something goes wrong (Mathematica kernel crashes, etc.), having saved both the results of the simulation and the current seed value of the random number generator's, I wouldn't have to start over and the results would still be fully deterministic/reproducible. I'd just load the seed value from the last file saved, call SeedRandom[currentSeedValue]
, initialize the loop counter to the value for the next iteration, and go on my merry way.
Does Mathematica have a function that returns the current value of the seed?