Notice that I'm not asking whether or not a language has a normal distribution functionality built in, I'm asking if you can "simulate" drawing a normal distribution random variable using a rand() function...推荐答案这是一种简单的工作方式(来自此处):Here is a simple way that works (from here): static Random r = new Random(); static double Normal(double mu, double sig) { double u, v, x, y, q; do { u = r.NextDouble(); v = 1.7156 * (r.NextDouble() - 0.5); x = u - 0.449871; y = Math.Abs(v) + 0.386595; q = Math.Sqrt(x) + y * (0.19600 * y - 0.25472 * x); } while (q > 0.27597 && (q > 0.27846 || Math.Sqrt(v) > -4.0 * Math.Log(u) * Math.Sqrt(u))); return mu + sig * v / u; } 这篇关于使用标准rand()函数从标准正态分布中提取随机数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
08-23 14:33