stats_dens_pmf_hypergeometric
(PECL stats >= 1.0.0)
stats_dens_pmf_hypergeometric — Probability mass function of the hypergeometric distribution
说明
Returns the probability mass at n1, where the random variable
follows the hypergeometric distribution of which the number of failure is
n2, the number of success samples is N1,
and the number of failure samples is N2.
参数
n1-
The number of success, at which the probability mass is calculated
n2-
The number of failure of the distribution
N1-
The number of success samples of the distribution
N2-
The number of failure samples of the distribution
返回值
The probability mass at n1 or false for failure.
+添加备注
用户贡献的备注 1 note
brendan at gamblingtec dot com ¶
5 years ago
You can use this method to work out lottery odds:
/**
* N is the population size OR total balls in the lottery draw
* K is the number of success states in the population OR the number of correct balls drawn from the pool
* n is the number of draws OR the number of times we draw from the pool to get the winning numbers.
*/
$N = 49; //Total balls in the pool
$K = 1; //Successful matches to win
$method = new Hypergeometric($N, $K, $K);
$odds = $method->pmf($K);
return 1/$odds;
//Will return 49备份地址:http://www.lvesu.com/blog/php/function.stats-dens-pmf-hypergeometric.php