Package oms3.ngmf.ui.calc
Class RandomNormal
- java.lang.Object
-
- oms3.ngmf.ui.calc.RandomNormal
-
public class RandomNormal extends Object
Utility class that generates normally-distributed random values using several algorithms.
-
-
Constructor Summary
Constructors Constructor Description RandomNormal()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description floatnextCentral()Compute the next random value using the Central Limit Theorem, which states that the averages of sets of uniformly-distributed random values are normally distributed.floatnextPolar()Compute the next randomn value using the polar algorithm.floatnextRatio()Compute the next random value using the ratio algorithm.voidsetParameters(float mean, float stddev)Set the mean and standard deviation.
-
-
-
Method Detail
-
setParameters
public void setParameters(float mean, float stddev)Set the mean and standard deviation.- Parameters:
mean- the meanstddev- the standard deviation
-
nextCentral
public float nextCentral()
Compute the next random value using the Central Limit Theorem, which states that the averages of sets of uniformly-distributed random values are normally distributed.
-
nextPolar
public float nextPolar()
Compute the next randomn value using the polar algorithm. Requires two uniformly-distributed random values in [-1, +1). Actually computes two random values and saves the second one for the next invokation.
-
nextRatio
public float nextRatio()
Compute the next random value using the ratio algorithm. Requires two uniformly-distributed random values in [0, 1).
-
-