Class AhrensDieterMarsagliaTsangGammaSampler.MarsagliaTsangGammaSampler

    • Field Detail

      • dOptim

        private final double dOptim
        Optimization (see code).
      • cOptim

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

      • MarsagliaTsangGammaSampler

        MarsagliaTsangGammaSampler​(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