|
SSJ V. 2.6.2. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object umontreal.iro.lecuyer.randvar.RandomVariateGen
public class RandomVariateGen
This is the base class for all random variate generators over the real line.
It specifies the signature of the nextDouble
method, which is
normally called to generate a real-valued random variate whose distribution
has been previously selected.
A random variate generator object can be created simply by invoking the
constructor of this class with previously created
RandomStream
and
Distribution
objects, or by invoking the constructor of a subclass.
By default, all random variates will be generated via
inversion by calling the
inverseF
method for the distribution, even though this can be inefficient in some cases.
For some of the distributions, there are subclasses with special and
more efficient methods to generate the random variates.
For generating many random variates, creating an object and calling the non-static method is more efficient when the generating algorithm involves a significant setup. When no work is done at setup time, the static methods are usually slightly faster.
Constructor Summary | |
---|---|
RandomVariateGen(RandomStream s,
Distribution dist)
Creates a new random variate generator from the distribution dist, using stream s. |
Method Summary | |
---|---|
Distribution |
getDistribution()
Returns the Distribution used by this generator. |
RandomStream |
getStream()
Returns the RandomStream used by this generator. |
void |
nextArrayOfDouble(double[] v,
int start,
int n)
Generates n random numbers from the continuous distribution contained in this object. |
double |
nextDouble()
Generates a random number from the continuous distribution contained in this object. |
void |
setStream(RandomStream stream)
Sets the RandomStream used by this generator to stream. |
String |
toString()
Returns a String containing information about the current generator. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public RandomVariateGen(RandomStream s, Distribution dist)
s
- random stream used for generating uniformsdist
- continuous distribution object of the generated valuesMethod Detail |
---|
public double nextDouble()
inverseF
method of the distribution object.
Alternative generating methods are provided in subclasses.
public void nextArrayOfDouble(double[] v, int start, int n)
nextDouble()
n
times, but one can override it in subclasses for better efficiency.
v
- array in which the variates will be storedstart
- starting index, in v, of the new variatesn
- number of variates to generatepublic RandomStream getStream()
RandomStream
used by this generator.
public void setStream(RandomStream stream)
RandomStream
used by this generator to stream.
public Distribution getDistribution()
Distribution
used by this generator.
public String toString()
toString
in class Object
|
SSJ V. 2.6.2. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |