Class RealUniform

java.lang.Object
org.flag4j.rng.distributions.Distribution<Double,Random>
org.flag4j.rng.distributions.RealUniform

public class RealUniform extends Distribution<Double,Random>

A 1D real uniform distribution \(\mathcal{U}(a, b)\).

The PDF of the uniform distribution \(\mathcal{U}(a, b)\) over the half open interval \( \left[a, b\right) \) where \( a < b \) is given by: \[ f(x) = \begin{cases} \frac{1}{b - a} & \text{for } x \in [a, b), \\ 0 & \text{otherwise}. \end{cases} \]

See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    final double
    Upper bound, \( b \), of the uniform distribution (exclusive).
    final double
    Lower bound, \( a \), of the uniform distribution (inclusive).

    Fields inherited from class org.flag4j.rng.distributions.Distribution

    rng
  • Constructor Summary

    Constructors
    Constructor
    Description
    RealUniform(Random rng, double min, double max)
    Constructs a real uniform distribution.
  • Method Summary

    Modifier and Type
    Method
    Description
    Randomly samples this uniform distribution.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • min

      public final double min
      Lower bound, \( a \), of the uniform distribution (inclusive).
    • max

      public final double max
      Upper bound, \( b \), of the uniform distribution (exclusive).
  • Constructor Details

    • RealUniform

      public RealUniform(Random rng, double min, double max)
      Constructs a real uniform distribution.
      Parameters:
      rng - Pseudorandom number generator to use when randomly sampling from this distribution.
      min - Lower bound of the uniform distribution (inclusive).
      max - Upper bound of the uniform distribution (exclusive).
  • Method Details

    • sample

      public Double sample()
      Randomly samples this uniform distribution.
      Specified by:
      sample in class Distribution<Double,Random>
      Returns:
      A pseudorandomrandom value distributed according to a uniform distribution between min (inclusive) and max (exclusive).