SSJ
V. 2.6.2.

umontreal.iro.lecuyer.randvar
Class UnuranDiscreteInt

java.lang.Object
  extended by umontreal.iro.lecuyer.randvar.RandomVariateGen
      extended by umontreal.iro.lecuyer.randvar.RandomVariateGenInt
          extended by umontreal.iro.lecuyer.randvar.UnuranDiscreteInt

public class UnuranDiscreteInt
extends RandomVariateGenInt

This class permits one to create a discrete univariate generator using UNURAN via its string API.


Constructor Summary
UnuranDiscreteInt(RandomStream s, RandomStream aux, String genStr)
          Constructs a new discrete random number generator using the UNURAN generator specification string genStr, main stream s, and auxiliary stream aux.
UnuranDiscreteInt(RandomStream s, String genStr)
          Same as UnuranDiscreteInt (s, s, genStr).
 
Method Summary
 RandomStream getAuxStream()
          Returns the auxiliary random number stream.
 DiscreteDistributionInt getDistribution()
          Returns the DiscreteDistributionInt used by this generator.
 RandomStream getStream()
          Returns the RandomStream 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
nextArrayOfDouble, nextDouble, setStream, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

UnuranDiscreteInt

public UnuranDiscreteInt(RandomStream s,
                         String genStr)
Same as UnuranDiscreteInt (s, s, genStr).


UnuranDiscreteInt

public UnuranDiscreteInt(RandomStream s,
                         RandomStream aux,
                         String genStr)
Constructs a new discrete random number generator using the UNURAN generator specification string genStr, main stream s, and auxiliary stream aux.

Method Detail

nextInt

public int nextInt()
Description copied from class: RandomVariateGenInt
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.

Overrides:
nextInt in class RandomVariateGenInt
Returns:
the generated value

nextArrayOfInt

public void nextArrayOfInt(int[] v,
                           int start,
                           int n)
Description copied from class: RandomVariateGenInt
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.

Overrides:
nextArrayOfInt in class RandomVariateGenInt
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()
Description copied from class: RandomVariateGenInt
Returns the DiscreteDistributionInt used by this generator.

Overrides:
getDistribution in class RandomVariateGenInt
Returns:
the distribution associated to that object

getStream

public RandomStream getStream()
Description copied from class: RandomVariateGen
Returns the RandomStream used by this generator.

Overrides:
getStream in class RandomVariateGen
Returns:
the stream associated to this object

getAuxStream

public RandomStream getAuxStream()
Returns the auxiliary random number stream.


SSJ
V. 2.6.2.

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