Class ContinuousUniformSampler

    • Constructor Detail

    • Method Detail

      • of

        public static SharedStateContinuousSampler of​(UniformRandomProvider rng,
                                                      double lo,
                                                      double hi)
        Creates a new continuous uniform distribution sampler.
        Parameters:
        rng - Generator of uniformly distributed random numbers.
        lo - Lower bound.
        hi - Higher bound.
        Returns:
        the sampler
        Since:
        1.3
      • of

        public static SharedStateContinuousSampler of​(UniformRandomProvider rng,
                                                      double lo,
                                                      double hi,
                                                      boolean excludeBounds)
        Creates a new continuous uniform distribution sampler.

        The bounds can be optionally excluded to sample from the open interval (lower, upper). In this case if the bounds have the same sign the open interval must contain at least 1 double value between the limits; if the bounds have opposite signs the open interval must contain at least 2 double values between the limits excluding -0.0. Thus the interval (-x,x) will raise an exception when x is Double.MIN_VALUE.

        Parameters:
        rng - Generator of uniformly distributed random numbers.
        lo - Lower bound.
        hi - Higher bound.
        excludeBounds - Set to true to use the open interval (lower, upper).
        Returns:
        the sampler
        Throws:
        IllegalArgumentException - If the open interval is invalid.
        Since:
        1.4