This is the base class for all random variate generators over the real line. More...
Public Member Functions | |
| RandomVariateGen (RandomStream s, Distribution dist) | |
| Creates a new random variate generator from the distribution dist, using stream s. | |
| double | nextDouble () |
| Generates a random number from the continuous distribution contained in this object. | |
| void | nextArrayOfDouble (double[] v, int start, int n) |
| Generates n random numbers from the continuous distribution contained in this object. | |
| double[] | nextArrayOfDouble (int n) |
| Generates n random numbers from the continuous distribution contained in this object, and returns them in a new array of size n. | |
| RandomStream | getStream () |
| Returns the umontreal.ssj.rng.RandomStream used by this generator. | |
| void | setStream (RandomStream stream) |
| Sets the umontreal.ssj.rng.RandomStream used by this generator to stream. | |
| Distribution | getDistribution () |
| Returns the umontreal.ssj.probdist.Distribution used by this generator. | |
| String | toString () |
| Returns a String containing information about the current generator. | |
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 umontreal.ssj.rng.RandomStream and
umontreal.ssj.probdist.Distribution objects, or by invoking the constructor of a subclass. By default, all random variates will be generated via inversion by calling the umontreal.ssj.probdist.Distribution.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.
Definition at line 55 of file RandomVariateGen.java.
| umontreal.ssj.randvar.RandomVariateGen.RandomVariateGen | ( | RandomStream | s, |
| Distribution | dist ) |
Creates a new random variate generator from the distribution dist, using stream s.
| s | random stream used for generating uniforms |
| dist | continuous distribution object of the generated values |
Definition at line 74 of file RandomVariateGen.java.
| Distribution umontreal.ssj.randvar.RandomVariateGen.getDistribution | ( | ) |
Returns the umontreal.ssj.probdist.Distribution used by this generator.
Reimplemented in umontreal.ssj.randvar.MixtureGen, umontreal.ssj.randvar.RandomVariateGenInt, and umontreal.ssj.randvar.RandomVariateGenWithCache.
Definition at line 149 of file RandomVariateGen.java.
| RandomStream umontreal.ssj.randvar.RandomVariateGen.getStream | ( | ) |
Returns the umontreal.ssj.rng.RandomStream used by this generator.
Reimplemented in umontreal.ssj.randvar.RandomVariateGenWithCache.
Definition at line 132 of file RandomVariateGen.java.
| void umontreal.ssj.randvar.RandomVariateGen.nextArrayOfDouble | ( | double[] | v, |
| int | start, | ||
| int | n ) |
Generates n random numbers from the continuous distribution contained in this object.
These numbers are stored in the array v, starting from index start. By default, this method calls nextDouble() n times, but one can override it in subclasses for better efficiency.
| v | array in which the variates will be stored |
| start | starting index, in v, of the new variates |
| n | number of variates to generate |
Reimplemented in umontreal.ssj.randvar.ConstantGen, and umontreal.ssj.randvar.RandomVariateGenWithCache.
Definition at line 102 of file RandomVariateGen.java.
| double[] umontreal.ssj.randvar.RandomVariateGen.nextArrayOfDouble | ( | int | n | ) |
Generates n random numbers from the continuous distribution contained in this object, and returns them in a new array of size n.
By default, this method calls nextDouble() n times, but one can override it in subclasses for better efficiency.
| n | number of variates to generate |
Definition at line 118 of file RandomVariateGen.java.
| double umontreal.ssj.randvar.RandomVariateGen.nextDouble | ( | ) |
Generates a random number from the continuous distribution contained in this object.
By default, this method uses inversion by calling the umontreal.ssj.probdist.ContinuousDistribution.inverseF method of the distribution object. Alternative generating methods are provided in subclasses.
Reimplemented in umontreal.ssj.randvar.BetaRejectionLoglogisticGen, umontreal.ssj.randvar.BetaStratifiedRejectionGen, umontreal.ssj.randvar.BetaSymmetricalBestGen, umontreal.ssj.randvar.BetaSymmetricalPolarGen, umontreal.ssj.randvar.ChiRatioOfUniformsGen, umontreal.ssj.randvar.ChiSquareNoncentralGamGen, umontreal.ssj.randvar.ChiSquareNoncentralPoisGen, umontreal.ssj.randvar.ConstantGen, umontreal.ssj.randvar.ErlangConvolutionGen, umontreal.ssj.randvar.FNoncentralGen, umontreal.ssj.randvar.GammaAcceptanceRejectionGen, umontreal.ssj.randvar.GammaRejectionLoglogisticGen, umontreal.ssj.randvar.InverseFromDensityGen, umontreal.ssj.randvar.InverseGaussianMSHGen, umontreal.ssj.randvar.KernelDensityGen, umontreal.ssj.randvar.KernelDensityVarCorrectGen, umontreal.ssj.randvar.LognormalSpecialGen, umontreal.ssj.randvar.MixtureGen, umontreal.ssj.randvar.NormalACRGen, umontreal.ssj.randvar.NormalBoxMullerGen, umontreal.ssj.randvar.NormalInverseGaussianIGGen, umontreal.ssj.randvar.NormalKindermannRamageGen, umontreal.ssj.randvar.NormalPolarGen, umontreal.ssj.randvar.RandomVariateGenWithCache, umontreal.ssj.randvar.StudentNoncentralGen, and umontreal.ssj.randvar.StudentPolarGen.
Definition at line 88 of file RandomVariateGen.java.
| void umontreal.ssj.randvar.RandomVariateGen.setStream | ( | RandomStream | stream | ) |
Sets the umontreal.ssj.rng.RandomStream used by this generator to stream.
Definition at line 140 of file RandomVariateGen.java.
| String umontreal.ssj.randvar.RandomVariateGen.toString | ( | ) |
Returns a String containing information about the current generator.
Definition at line 156 of file RandomVariateGen.java.