如何从Java中的gamma分布生成数字?
答案 0 :(得分:2)
来自Apache Commons-Math软件包的GammaDistribution
:
double sample = new GammaDistribution(shape, scale).sample();
答案 1 :(得分: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.