Class AhrensDieterExponentialSampler

java.lang.Object
org.apache.commons.rng.sampling.distribution.SamplerBase
org.apache.commons.rng.sampling.distribution.AhrensDieterExponentialSampler
All Implemented Interfaces:
ContinuousSampler, SharedStateContinuousSampler, SharedStateSampler<SharedStateContinuousSampler>

public class AhrensDieterExponentialSampler extends SamplerBase implements SharedStateContinuousSampler
Since:
1.0
  • Field Details

    • EXPONENTIAL_SA_QI

      private static final double[] EXPONENTIAL_SA_QI
      Table containing the constants \( q_i = sum_{j=1}^i (\ln 2)^j / j! = \ln 2 + (\ln 2)^2 / 2 + ... + (\ln 2)^i / i! \) until the largest representable fraction below 1 is exceeded. Note that \( 1 = 2 - 1 = \exp(\ln 2) - 1 = sum_{n=1}^\infinity (\ln 2)^n / n! \) thus \( q_i \rightarrow 1 as i \rightarrow +\infinity \), so the higher \( i \), the closer we get to 1 (the series is not alternating). By trying, n = 16 in Java is enough to reach 1.
    • mean

      private final double mean
      The mean of this distribution.
    • rng

      private final UniformRandomProvider rng
      Underlying source of randomness.
  • Constructor Details

    • AhrensDieterExponentialSampler

      public AhrensDieterExponentialSampler(UniformRandomProvider rng, double mean)
      Create an instance.
      Parameters:
      rng - Generator of uniformly distributed random numbers.
      mean - Mean of this distribution.
      Throws:
      IllegalArgumentException - if mean <= 0
    • AhrensDieterExponentialSampler

      private AhrensDieterExponentialSampler(double mean, UniformRandomProvider rng)
      Parameters:
      mean - Mean.
      rng - Generator of uniformly distributed random numbers.
  • Method Details