当前位置: 首页>>代码示例>>Java>>正文


Java LocalizedFormats.OUT_OF_RANGE_LEFT属性代码示例

本文整理汇总了Java中org.apache.commons.math3.exception.util.LocalizedFormats.OUT_OF_RANGE_LEFT属性的典型用法代码示例。如果您正苦于以下问题:Java LocalizedFormats.OUT_OF_RANGE_LEFT属性的具体用法?Java LocalizedFormats.OUT_OF_RANGE_LEFT怎么用?Java LocalizedFormats.OUT_OF_RANGE_LEFT使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.apache.commons.math3.exception.util.LocalizedFormats的用法示例。


在下文中一共展示了LocalizedFormats.OUT_OF_RANGE_LEFT属性的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: GeometricDistribution

/**
 * Creates a geometric distribution.
 *
 * @param rng Random number generator.
 * @param p Probability of success.
 * @throws OutOfRangeException if {@code p <= 0} or {@code p > 1}.
 */
public GeometricDistribution(RandomGenerator rng, double p) {
    super(rng);

    if (p <= 0 || p > 1) {
        throw new OutOfRangeException(LocalizedFormats.OUT_OF_RANGE_LEFT, p, 0, 1);
    }

    probabilityOfSuccess = p;
    logProbabilityOfSuccess = FastMath.log(p);
    log1mProbabilityOfSuccess = FastMath.log1p(-p);
}
 
开发者ID:biocompibens,项目名称:SME,代码行数:18,代码来源:GeometricDistribution.java

示例2: StableRandomGenerator

/**
 * Create a new generator.
 *
 * @param generator underlying random generator to use
 * @param alpha Stability parameter. Must be in range (0, 2]
 * @param beta Skewness parameter. Must be in range [-1, 1]
 * @throws NullArgumentException if generator is null
 * @throws OutOfRangeException if {@code alpha <= 0} or {@code alpha > 2}
 * or {@code beta < -1} or {@code beta > 1}
 */
public StableRandomGenerator(final RandomGenerator generator,
                             final double alpha, final double beta)
    throws NullArgumentException, OutOfRangeException {
    if (generator == null) {
        throw new NullArgumentException();
    }

    if (!(alpha > 0d && alpha <= 2d)) {
        throw new OutOfRangeException(LocalizedFormats.OUT_OF_RANGE_LEFT,
                alpha, 0, 2);
    }

    if (!(beta >= -1d && beta <= 1d)) {
        throw new OutOfRangeException(LocalizedFormats.OUT_OF_RANGE_SIMPLE,
                beta, -1, 1);
    }

    this.generator = generator;
    this.alpha = alpha;
    this.beta = beta;
    if (alpha < 2d && beta != 0d) {
        zeta = beta * FastMath.tan(FastMath.PI * alpha / 2);
    } else {
        zeta = 0d;
    }
}
 
开发者ID:biocompibens,项目名称:SME,代码行数:36,代码来源:StableRandomGenerator.java


注:本文中的org.apache.commons.math3.exception.util.LocalizedFormats.OUT_OF_RANGE_LEFT属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。