SSJ
V. labo.

umontreal.iro.lecuyer.randvar
Class GeometricGen

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

public class GeometricGen
extends RandomVariateGenInt

GeometricGen

This class implements a random variate generator for the geometric distribution. Its has parameter p and mass function

p(x) = p(1 - p)x for x = 0, 1, 2,...,$\displaystyle \eqlabel$eq:fgeom

where 0≤p≤1. Random variates are generated by calling inversion on the distribution object.


Constructor Summary
GeometricGen(RandomStream s, double p)
          .
GeometricGen(RandomStream s, GeometricDist dist)
          .
 
Method Summary
 double getP()
          .
 int nextInt()
          .
static int nextInt(RandomStream s, double p)
          .
 
Methods inherited from class umontreal.iro.lecuyer.randvar.RandomVariateGenInt
getDistribution, nextArrayOfInt
 
Methods inherited from class umontreal.iro.lecuyer.randvar.RandomVariateGen
getStream, nextArrayOfDouble, nextDouble, setStream, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

GeometricGen

public GeometricGen(RandomStream s,
                    double p)
. \begin{tabb}Creates a geometric random variate generator with
 parameter $p$, using stream \texttt{s}.
 \end{tabb}


GeometricGen

public GeometricGen(RandomStream s,
                    GeometricDist dist)
. \begin{tabb}Creates a new generator for the distribution \texttt{dist}, using
 stream \texttt{s}.
 \end{tabb}

Method Detail

nextInt

public int nextInt()
Description copied from class: RandomVariateGenInt
. \begin{tabb}
 Generates a random number (an integer) from the discrete
 distribu...
 ... object.
 Alternative generating methods are provided in subclasses.
 \end{tabb}
the generated value

Overrides:
nextInt in class RandomVariateGenInt

nextInt

public static int nextInt(RandomStream s,
                          double p)
. \begin{tabb}Generates a {\em geometric\/} random variate with parameter
 $p = $~\texttt{p}, using stream \texttt{s}, by inversion.
 \end{tabb}


getP

public double getP()
. \begin{tabb}Returns the parameter $p$\ of this object.
 \end{tabb}

 


SSJ
V. labo.

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