Save and restore random state after each iteration to make interrupted runs reproducable (and not replay the same random numbers).
Currently, we set the random seed from optimizer.json. Thus, whenever a run is restarted, the random seed is set to random_seed, instead of the state that the random number generator was in when the run was interrupted. So we need to store the random state in the .pkl restart files and restore it when resuming.
Save and restore random state after each iteration to make interrupted runs reproducable (and not replay the same random numbers).
Currently, we set the random seed from optimizer.json. Thus, whenever a run is restarted, the random seed is set to random_seed, instead of the state that the random number generator was in when the run was interrupted. So we need to store the random state in the .pkl restart files and restore it when resuming.