Class TSampler.StudentsTSampler

    • Field Detail

      • LARGE_DF

        private static final double LARGE_DF
        Threshold for large degrees of freedom.
        See Also:
        Constant Field Values
      • DOUBLE_MULTIPLIER

        private static final double DOUBLE_MULTIPLIER
        The multiplier to convert the least significant 53-bits of a long to a uniform double.
        See Also:
        Constant Field Values
      • df

        private final double df
        Degrees of freedom.
      • powm1

        private final java.util.function.DoubleUnaryOperator powm1
        Function to compute pow(x, -2/v) - 1, where v = degrees of freedom.
    • Constructor Detail

      • StudentsTSampler

        StudentsTSampler​(UniformRandomProvider rng,
                         double v)
        Parameters:
        rng - Generator of uniformly distributed random numbers.
        v - Degrees of freedom.
    • Method Detail

      • sample

        public double sample()
        Creates a double sample.
        Returns:
        a sample.
      • makeSignedDouble

        private static double makeSignedDouble​(long bits)
        Creates a signed double in the range [-1, 1). The magnitude is sampled evenly from the 254 dyadic rationals in the range.

        Note: This method will not return samples for both -0.0 and 0.0.

        Parameters:
        bits - the bits
        Returns:
        the double