在Java中从gamma分布生成随机值
如何从Java中的gamma发行版生成数字?来自Apache Commons数学包:在Java中从gamma分布生成随机值,java,random,gamma-distribution,Java,Random,Gamma Distribution,如何从Java中的gamma发行版生成数字?来自Apache Commons数学包: double sample = new GammaDistribution(shape, scale).sample(); Apache Commons Math 3.3 API中存在一种可能性 GammaDistribution(double shape, double scale) // Creates a new gamma distribution with specified values of t
double sample = new GammaDistribution(shape, scale).sample();
Apache Commons Math 3.3 API中存在一种可能性
GammaDistribution(double shape, double scale)
// Creates a new gamma distribution with specified values of the shape and scale parameters.
GammaDistribution(double shape, double scale, double inverseCumAccuracy)
// Creates a new gamma distribution with specified values of the shape and scale parameters.
GammaDistribution(RandomGenerator rng, double shape, double scale)
// Creates a Gamma distribution.
GammaDistribution(RandomGenerator rng, double shape, double scale, double inverseCumAccuracy)
// Creates a Gamma distribution.
参考资料:非常感谢您的回复,我对java非常陌生,我想我应该下载Apache Commons Math 3.3 API,然后将其添加到eclipse中的路径中,是这样吗?是的,是这样!将库添加到构建路径,然后您可以在程序中使用它!我得到了答案谢谢抱歉,但我从他那里得到了解决方案他解释了如何用java实现我必须公平我再次道歉抱歉,那倒伽马呢?这个apachecommons数学库可以做到这一点吗?