正态分布,即
Normal Distribution
,又名
高斯分布
,对应的高斯方程在
http://en.wikipedia.org/wiki/Gaussian_function
。
本算法主要参考: http://en.wikipedia.org/wiki/Box-Muller_transform ,使用PHP实现的。
本算法主要参考: http://en.wikipedia.org/wiki/Box-Muller_transform ,使用PHP实现的。
<?php
/*
* 使用Box-Mueller方法,生成正态分布随机数。
*
* @desc 使用Box-Mueller方法,生成正态分布随机数。
* @return float 随机数
*/
function normalRand() {
static $last = FALSE;
static $n;
$useLast = FALSE;
if ($last) {
$last = FALSE;
。。。。。。
详细代码请见: http://charly2018.web-45.com/wordpress/?p=65