SSJ
V. 1.2.5.

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 distribution 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.
 Distribution getDistribution()
          Returns the Distribution 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
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, 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 Distribution getDistribution()
Description copied from class: RandomVariateGen
Returns the Distribution used by this generator.

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

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