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 RandomVariateGenInt

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

Direct Known Subclasses:
  BinomialGen, GeometricGen, HypergeometricGen, LogarithmicGen, NegativeBinomialGen, PascalGen, PoissonGen, UniformIntGen, UnuranDiscreteInt

    public class RandomVariateGenInt

extends RandomVariateGen

This is the base class for all generators of discrete random variates over the set of integers. Similar to `RandomVariateGen`, except that the generators produce integers, via the `nextInt` method, instead of real numbers.

Constructor Summary
`RandomVariateGenInt(RandomStream s, DiscreteDistributionInt dist)` Creates a new random variate generator for the discrete distribution `dist`, using stream `s`.

Method Summary
`DiscreteDistributionInt` | `getDistribution()` Returns the `DiscreteDistributionInt` used by this generator.
`void` | `nextArrayOfInt(int[] v, int start, int n)` Generates `n` random numbers from the discrete distribution contained in this object.
`int` | `nextInt()` Generates a random number (an integer) from the discrete distribution contained in this object.

Methods inherited from class umontreal.iro.lecuyer.randvar.RandomVariateGen
`getStream, nextArrayOfDouble, nextDouble, setStream`

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

Constructor Detail

### RandomVariateGenInt

    public RandomVariateGenInt(RandomStream s,
                               DiscreteDistributionInt dist)

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

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

Method Detail

### nextInt

    public int nextInt()

  Generates a random number (an integer) from the discrete 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

### nextArrayOfInt

    public void nextArrayOfInt(int[] v,
                               int start,
                               int n)

  Generates `n` random numbers from the discrete distribution contained in this object. The results are stored into the array `v`, starting from index `start`. By default, this method calls `nextInt()` `n` times, but one can reimplement it in subclasses for better efficiency.

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

### getDistribution

    public DiscreteDistributionInt getDistribution()

  Returns the `DiscreteDistributionInt` used by this generator.

  Overrides:
    `getDistribution` in class `RandomVariateGen`
  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.