Overview | Package | Class | Tree | Deprecated | Index | Help
| SSJ V. 2.1.1.
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## umontreal.iro.lecuyer.randvar
Class RandomVariateGen

    java.lang.Object
      umontreal.iro.lecuyer.randvar.RandomVariateGen

Direct Known Subclasses:
  BetaGen, CauchyGen, ChiGen, ChiSquareGen, ChiSquareNoncentralGen, ExponentialGen, ExtremeValueGen, FatigueLifeGen, FisherFGen, FoldedNormalGen, GammaGen, HalfNormalGen, HyperbolicSecantGen, InverseGaussianGen, JohnsonSBGen, JohnsonSUGen, KernelDensityGen, LaplaceGen, LogisticGen, LoglogisticGen, LognormalGen, LognormalSpecialGen, NakagamiGen, NormalGen, NormalInverseGaussianGen, ParetoGen, Pearson5Gen, Pearson6Gen, PowerGen, RandomVariateGenInt, RandomVariateGenWithCache, RayleighGen, StudentGen, TriangularGen, UniformGen, UnuranContinuous, UnuranEmpirical, WeibullGen

    public class RandomVariateGen

extends Object

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`.

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### RandomVariateGen

    public RandomVariateGen(RandomStream s,
                            Distribution dist)

  Creates a new random variate generator from the distribution `dist`, using stream `s`.

  Parameters:
    `s` - random stream used for generating uniforms
    `dist` - continuous distribution object of the generated values

Method Detail

### nextDouble

    public double nextDouble()

  Generates a random number from the continuous distribution contained in this object. By default, this method uses inversion by calling the `inverseF` method of the distribution object. Alternative generating methods are provided in subclasses.

  Returns:
    the generated value

### nextArrayOfDouble

    public void 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.

  Parameters:
    `v` - array in which the variates will be stored
    `start` - starting index, in `v`, of the new variates
    `n` - number of variates to generate

### getStream

    public RandomStream getStream()

  Returns the `RandomStream` used by this generator.

  Returns:
    the stream associated to this object

### setStream

    public void setStream(RandomStream stream)

  Sets the `RandomStream` used by this generator to `stream`.

### getDistribution

    public Distribution getDistribution()

  Returns the `Distribution` used by this generator.

  Returns:
    the distribution associated to that object

Overview | Package | Class | Tree | Deprecated | Index | Help
| SSJ V. 2.1.1.
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

To submit a bug or ask questions, send an e-mail to Pierre L'Ecuyer.