Per the title, seeded random number generation is now available in PSim. The random number generator is owned by the simulation class and is therefore seeded in each individual instantiation of a simulation - very helpful if we want to run multiple sims in parallel at some point. Each model class then has access to the random number generator via the _randoms member variable shared across all models.
You can generate random numbers using the standard lin utilities:
#include <lin/generators/randoms.hpp>
... {
// To make lin objects:
auto gaussians = lin::gaussians<...>(_randoms,...);
auto randoms = lin::rands<...>(_randoms,...);
// Just a single scalar
auto gaussian = _randoms.gaussian();
auto random = _randoms.rand();
}
I reran simulation locally to verify the change wasn't breaking. You can also see the random number generator in action in #278.
Closes #252.
Seeded Random Number Generation in PSim
Per the title, seeded random number generation is now available in PSim. The random number generator is owned by the simulation class and is therefore seeded in each individual instantiation of a simulation - very helpful if we want to run multiple sims in parallel at some point. Each model class then has access to the random number generator via the
_randoms
member variable shared across all models.You can generate random numbers using the standard
lin
utilities:I reran simulation locally to verify the change wasn't breaking. You can also see the random number generator in action in #278.