本文整理了Java中org.apache.commons.math3.random.RandomDataGenerator.nextGamma
方法的一些代码示例,展示了RandomDataGenerator.nextGamma
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。RandomDataGenerator.nextGamma
方法的具体详情如下:
包路径:org.apache.commons.math3.random.RandomDataGenerator
类名称:RandomDataGenerator
方法名:nextGamma
[英]Generates a random value from the org.apache.commons.math3.distribution.GammaDistribution.
This implementation uses the following algorithms:
For 0 < shape < 1:
Ahrens, J. H. and Dieter, U., Computer methods for sampling from gamma, beta, Poisson and binomial distributions. Computing, 12, 223-246, 1974.
For shape >= 1:
Marsaglia and Tsang, A Simple Method for Generating Gamma Variables. ACM Transactions on Mathematical Software, Volume 26 Issue 3, September, 2000.
[中]从组织生成一个随机值。阿帕奇。平民数学3。分配分配。
此实现使用以下算法:
对于0<形状<1:
Ahrens,J.H.和Dieter,U.,《从伽马分布、贝塔分布、泊松分布和二项分布中取样的计算机方法》。《计算机》,12223-2461974年。
对于大于等于1的形状:
Marsaglia和Tsang,一种生成伽马变量的简单方法。ACM数学软件交易,第26卷,第3期,2000年9月。
代码示例来源:origin: org.apache.commons/commons-math3
/**
* <p>Generates a random value from the
* {@link org.apache.commons.math3.distribution.GammaDistribution Gamma Distribution}.</p>
*
* <p>This implementation uses the following algorithms: </p>
*
* <p>For 0 < shape < 1: <br/>
* Ahrens, J. H. and Dieter, U., <i>Computer methods for
* sampling from gamma, beta, Poisson and binomial distributions.</i>
* Computing, 12, 223-246, 1974.</p>
*
* <p>For shape >= 1: <br/>
* Marsaglia and Tsang, <i>A Simple Method for Generating
* Gamma Variables.</i> ACM Transactions on Mathematical Software,
* Volume 26 Issue 3, September, 2000.</p>
*
* @param shape the median of the Gamma distribution
* @param scale the scale parameter of the Gamma distribution
* @return random value sampled from the Gamma(shape, scale) distribution
* @throws NotStrictlyPositiveException if {@code shape <= 0} or
* {@code scale <= 0}.
* @since 2.2
*/
public double nextGamma(double shape, double scale) throws NotStrictlyPositiveException {
return delegate.nextGamma(shape, scale);
}
代码示例来源:origin: geogebra/geogebra
/**
* <p>Generates a random value from the
* {@link org.apache.commons.math3.distribution.GammaDistribution Gamma Distribution}.</p>
*
* <p>This implementation uses the following algorithms: </p>
*
* <p>For 0 < shape < 1: <br/>
* Ahrens, J. H. and Dieter, U., <i>Computer methods for
* sampling from gamma, beta, Poisson and binomial distributions.</i>
* Computing, 12, 223-246, 1974.</p>
*
* <p>For shape >= 1: <br/>
* Marsaglia and Tsang, <i>A Simple Method for Generating
* Gamma Variables.</i> ACM Transactions on Mathematical Software,
* Volume 26 Issue 3, September, 2000.</p>
*
* @param shape the median of the Gamma distribution
* @param scale the scale parameter of the Gamma distribution
* @return random value sampled from the Gamma(shape, scale) distribution
* @throws NotStrictlyPositiveException if {@code shape <= 0} or
* {@code scale <= 0}.
* @since 2.2
*/
public double nextGamma(double shape, double scale) throws NotStrictlyPositiveException {
return delegate.nextGamma(shape, scale);
}
代码示例来源:origin: io.virtdata/virtdata-lib-realer
/**
* <p>Generates a random value from the
* {@link org.apache.commons.math3.distribution.GammaDistribution Gamma Distribution}.</p>
*
* <p>This implementation uses the following algorithms: </p>
*
* <p>For 0 < shape < 1: <br/>
* Ahrens, J. H. and Dieter, U., <i>Computer methods for
* sampling from gamma, beta, Poisson and binomial distributions.</i>
* Computing, 12, 223-246, 1974.</p>
*
* <p>For shape >= 1: <br/>
* Marsaglia and Tsang, <i>A Simple Method for Generating
* Gamma Variables.</i> ACM Transactions on Mathematical Software,
* Volume 26 Issue 3, September, 2000.</p>
*
* @param shape the median of the Gamma distribution
* @param scale the scale parameter of the Gamma distribution
* @return random value sampled from the Gamma(shape, scale) distribution
* @throws NotStrictlyPositiveException if {@code shape <= 0} or
* {@code scale <= 0}.
* @since 2.2
*/
public double nextGamma(double shape, double scale) throws NotStrictlyPositiveException {
return delegate.nextGamma(shape, scale);
}
代码示例来源:origin: zitmen/thunderstorm
/**
* Replaces each pixel value with a sample from a Gamma distribution with shape equal to the original pixel value and scale equal to the gain parameter.
*/
FloatProcessor sampleGamma(FloatProcessor fp, double gain){
for(int i = 0; i < fp.getPixelCount(); i ++){
double value = fp.getf(i);
value = rand.nextGamma(value + 1e-10, gain);
fp.setf(i, (float)value);
}
return fp;
}
内容来源于网络,如有侵权,请联系作者删除!