Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/335.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在Java中从gamma分布生成随机值_Java_Random_Gamma Distribution - Fatal编程技术网

在Java中从gamma分布生成随机值

在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

如何从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 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数学库可以做到这一点吗?