|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sourceforge.cilib.math.random.RandomNumber
public class RandomNumber
This class provides the needed functionality to sample random numbers from different continuous valued distributions.
These distributions include:
Constructor Summary | |
---|---|
RandomNumber()
Create a RandomNumber instance. |
|
RandomNumber(RandomNumber copy)
|
Method Summary | |
---|---|
double |
getCauchy()
Convenience method to obtain a Cauchy number. |
double |
getCauchy(double location,
double scale)
Return a random number sampled from the Cauchy distribution. |
RandomNumber |
getClone()
Create a cloned copy of the current object and return it. |
double |
getGaussian()
Return a random number from the Guassian distribution with a mean of
0.0 and a deviation of 1.0. |
double |
getGaussian(double location,
double scale)
Return a random number with the mean of mean and a deviation of
deviation . |
double |
getNormal()
|
double |
getNormal(double location,
double scale)
Convenience method for getGaussian() . |
Random |
getRandomGenerator()
Return the random number generator being used. |
double |
getUniform()
Get a uniform random number located within 0 <= x < 1 . |
double |
getUniform(double lower,
double upper)
Get the uniform random number. |
void |
setRandomGenerator(Random random)
Set the random number generator to be used. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public RandomNumber()
RandomNumber
instance. The internal random number generator is
defined to be the MersenneTwister
by default with a mean
of 0.0 and a deviation
of 1.0.
public RandomNumber(RandomNumber copy)
Method Detail |
---|
public RandomNumber getClone()
Cloneable
getClone
in interface Cloneable
Object.clone()
public Random getRandomGenerator()
public void setRandomGenerator(Random random)
random
- The random number generator to be used.public double getGaussian()
mean
of
0.0 and a deviation
of 1.0.
public double getGaussian(double location, double scale)
mean
and a deviation of
deviation
. Based on the formula:s*U(0, 1) + m == U(m, s)
ALGORITHM 712, COLLECTED ALGORITHMS FROM ACM.
THIS WORK PUBLISHED IN TRANSACTIONS ON MATHEMATICAL SOFTWARE,
VOL. 18, NO. 4, DECEMBER, 1992, PP. 434-435.
The function returns a normally distributed pseudo-random number
with a given mean and standard deviation. Calls are made to a
function subprogram which must return independent random
numbers uniform in the interval (0,1).
The algorithm uses the ratio of uniforms method of A.J. Kinderman and J.F. Monahan augmented with quadratic bounding curves.
mean
and deviation deviation
public double getNormal()
public double getNormal(double location, double scale)
getGaussian()
.
location
- The location of the mean of the distribution.scale
- The allowed variation that can be observed.
location
and deviation scale
.public double getCauchy()
mean
of 0.0
and a deviation
of 1.0
.
public double getCauchy(double location, double scale)
location
- The location of the mean of the distribution.scale
- The allowed variation that can be observed.
public double getUniform()
0 <= x < 1
.
0 <= x < 1
).public double getUniform(double lower, double upper)
A <= x < B
where A == mean
and B == deviation
.
lower
- The lower bound for the number generation.upper
- The upper bound for the number generation.
lower <= x < upper
).
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |