/* * File: random.h * Author: bkwiatek */ #ifndef RANDOM_H #define RANDOM_H double SampleNormal (double mean, double sigma) { // Create a Mersenne twister random number generator static mt19937 rng(static_cast (std::time(0))); // select Gaussian probability distribution normal_distribution norm_dist(mean, sigma); // bind random number generator to distribution variate_generator > normal_sampler(rng, norm_dist); // sample from the distribution return normal_sampler(); } #endif /* RANDOM_H */