Class AhrensDieterMarsagliaTsangGammaSampler.AhrensDieterGammaSampler

    • Field Detail

      • oneOverAlpha

        private final double oneOverAlpha
        Inverse of "alpha".
      • bGSOptim

        private final double bGSOptim
        Optimization (see code).
    • Constructor Detail

      • AhrensDieterGammaSampler

        AhrensDieterGammaSampler​(UniformRandomProvider rng,
                                 double alpha,
                                 double theta)
        Parameters:
        rng - Generator of uniformly distributed random numbers.
        alpha - Alpha parameter of the distribution.
        theta - Theta parameter of the distribution.
        Throws:
        java.lang.IllegalArgumentException - if alpha <= 0 or theta <= 0
    • Method Detail

      • sample

        public double sample()
        Description copied from interface: ContinuousSampler
        Creates a double sample.
        Returns:
        a sample.
      • withUniformRandomProvider

        public SharedStateContinuousSampler withUniformRandomProvider​(UniformRandomProvider rng)
        Description copied from interface: SharedStateSampler
        Create a new instance of the sampler with the same underlying state using the given uniform random provider as the source of randomness.
        Parameters:
        rng - Generator of uniformly distributed random numbers.
        Returns:
        the sampler