Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This adds one way to implement Common Random Numbers (CRN). This is a method for reducing the number of draws required in order to get good statistical power on an estimate of the effect of changes to parameters in a simulation. The idea is to run a simulation once, recording its randomness, then for each modification of the parameters, run the simulation with the same underlying randomness. This will destroy any measurements of the dispersion of trajectories, but it will tell you centrality measures with many fewer draws.
This implementation records the state of the random number generator before each and every enabling of a distribution. That would be crazy to do with a Mersenne twister random number generator because its state is large, but a Xoshiro generator has 32 bytes. This is still large, but is manageable. The advantage to this, over recording draws from uniform numbers, is that it lets the sampler use the fastest available methods to sample distributions. Disadvantages are that it needs more memory.