1

如何从 Java 中的伽马分布生成数字?

4

2 回答 2

2

来自 Apache Commons GammaDistribution-Math 包:

double sample = new GammaDistribution(shape, scale).sample();
于 2014-09-17T07:46:28.223 回答
1

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.

参考:http ://commons.apache.org/proper/commons-math/apidocs/org/apache/commons/math3/distribution/GammaDistribution.html

于 2014-09-17T07:48:52.323 回答