Class ZigguratNormalizedGaussianSampler

    • Field Detail

      • LAST

        private static final int LAST
        Index of last entry in the tables (which have a size that is a power of 2).
        See Also:
        Constant Field Values
      • K

        private static final long[] K
        Auxiliary table.
      • W

        private static final double[] W
        Auxiliary table.
      • F

        private static final double[] F
        Auxiliary table.
    • Constructor Detail

      • ZigguratNormalizedGaussianSampler

        public ZigguratNormalizedGaussianSampler​(UniformRandomProvider rng)
        Create an instance.
        Parameters:
        rng - Generator of uniformly distributed random numbers.
    • Method Detail

      • sample

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

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • fix

        private double fix​(long hz,
                           int iz)
        Gets the value from the tail of the distribution.
        Parameters:
        hz - Start random integer.
        iz - Index of cell corresponding to hz.
        Returns:
        the requested random value.
      • pdf

        private static double pdf​(double x)
        Compute the Gaussian probability density function f(x) = e^-0.5x^2.
        Parameters:
        x - Argument.
        Returns:
        \( e^{-\frac{x^2}{2}} \)