DoubleSupplier
@ThreadSafe public final class RandomScalar extends Object implements DoubleSupplier
getMu()
and getSigma()
. The
distribution of these random variables is close to that of a normal
distribution, with a mean of μ and a standard deviation of σ, but
modified a bit to ensure that values will never be negative. The true value,
if Z is a standard normal random variable, is μ × eZ ×
σ / μ. Note that the median value of a random scalar is
exactly μ, while the mean or expected value is a bit higher.Constructor | Description |
---|---|
RandomScalar(double mu,
double sigma) |
Creates a random scalar with the given μ and σ.
|
Modifier and Type | Method | Description |
---|---|---|
boolean |
equals(Object obj) |
|
double |
getAsDouble() |
Generates a value from the continuous distribution represented by this
random scalar.
|
double |
getMu() |
Returns the μ value for this random scalar.
|
double |
getSigma() |
Returns the σ value for this random scalar.
|
int |
hashCode() |
|
String |
toString() |
public RandomScalar(double mu, double sigma)
mu
- the μ value for the random scalarsigma
- the σ value for the random scalarIllegalArgumentException
- if mu or sigma is not finite and positivepublic double getMu()
public double getSigma()
public double getAsDouble()
getAsDouble
in interface DoubleSupplier