This repository has been archived on 2020-04-08. You can view files and clone it, but cannot push or open issues or pull requests.
Files
Indoor/math/random/Normal.h
2017-11-15 17:46:06 +01:00

28 lines
485 B
C++

#ifndef K_MATH_RND_NORMAL_H
#define K_MATH_RND_NORMAL_H
namespace Random {
/**
* provides some common functions
* for handling normal-distributed random numbers
*/
class Normal {
public:
/** get normal-distributed random number for given mu/sigma */
static double get(double mu, double sigma) {
static std::random_device rd;
static std::mt19937 gen(rd());
std::normal_distribution<> d(mu, sigma);
return d(gen);
}
};
}
#endif // K_MATH_RND_NORMAL_H