Class AhrensDieterMarsagliaTsangGammaSampler

    • Constructor Detail

      • AhrensDieterMarsagliaTsangGammaSampler

        public AhrensDieterMarsagliaTsangGammaSampler​(UniformRandomProvider rng,
                                                      double alpha,
                                                      double theta)
        This instance delegates sampling. Use the factory method of(UniformRandomProvider, double, double) to create an optimal sampler.
        Parameters:
        rng - Generator of uniformly distributed random numbers.
        alpha - Alpha parameter of the distribution (this is a shape parameter).
        theta - Theta parameter of the distribution (this is a scale parameter).
        Throws:
        java.lang.IllegalArgumentException - if alpha <= 0 or theta <= 0
    • Method Detail

      • sample

        public double sample()
        Creates a double sample.
        Specified by:
        sample in interface ContinuousSampler
        Returns:
        a sample.
      • of

        public static SharedStateContinuousSampler of​(UniformRandomProvider rng,
                                                      double alpha,
                                                      double theta)
        Creates a new gamma distribution sampler.
        Parameters:
        rng - Generator of uniformly distributed random numbers.
        alpha - Alpha parameter of the distribution (this is a shape parameter).
        theta - Theta parameter of the distribution (this is a scale parameter).
        Returns:
        the sampler
        Throws:
        java.lang.IllegalArgumentException - if alpha <= 0 or theta <= 0
        Since:
        1.3