算法
NORMAL(mean , stddev , gen)
期望当 gen 是一个 random() 随机数时,NORMAL 的输出结果满足正态分布。也就是说,NORMAL 函数的功能是将 random() 映射到一个正态分布的空间上。
实现
- 使用 stl 提供的算法
- 使用 Box Muller Transform 方法
参考
Normal distribution 参考:https://en.cppreference.com/w/cpp/numeric/random/normal_distribution
正态分布参考2:https://qinqianshan.com/math/probability_distribution/normal-distribution/
Gcc 中 Normal Distribution 的实现:https://github.com/gcc-mirror/gcc/blob/master/libstdc%2B%2B-v3/include/bits/random.tcc
正态分布可视化:https://homepage.divms.uiowa.edu/~mbognar/applets/normal.html