SSJ API Documentation
Stochastic Simulation in Java
Loading...
Searching...
No Matches
umontreal.ssj.randvar.LogarithmicGen Class Reference

This class implements random variate generators for the (discrete) logarithmic distribution. More...

Inheritance diagram for umontreal.ssj.randvar.LogarithmicGen:
umontreal.ssj.randvar.RandomVariateGenInt umontreal.ssj.randvar.RandomVariateGen

Public Member Functions

 LogarithmicGen (RandomStream s, double theta)
 Creates a logarithmic random variate generator with parameters.
 LogarithmicGen (RandomStream s, double theta, double theta0)
 Creates a logarithmic random variate generator with parameters.
 LogarithmicGen (RandomStream s, LogarithmicDist dist)
 Creates a new generator with distribution dist and stream s, with default value \(\theta_0 = 0.96\).
 LogarithmicGen (RandomStream s, LogarithmicDist dist, double theta0)
 Creates a new generator with distribution dist and stream s, with \(\theta_0 = \mathtt{theta0}\).
int nextInt ()
 Generates a random number (an integer) from the discrete distribution contained in this object.
double getTheta ()
 Returns the \(\theta\) associated with this object.
double getTheta0 ()
 Returns the \(\theta_0\) associated with this object.
Public Member Functions inherited from umontreal.ssj.randvar.RandomVariateGenInt
 RandomVariateGenInt (RandomStream s, DiscreteDistributionInt dist)
 Creates a new random variate generator for the discrete distribution dist, using stream s.
void nextArrayOfInt (int[] v, int start, int n)
 Generates n random numbers from the discrete distribution contained in this object.
int[] nextArrayOfInt (int n)
 Generates n random numbers from the discrete distribution contained in this object, and returns them in a new array of size n.
DiscreteDistributionInt getDistribution ()
 Returns the umontreal.ssj.probdist.DiscreteDistributionInt used by this generator.
Public Member Functions inherited from umontreal.ssj.randvar.RandomVariateGen
 RandomVariateGen (RandomStream s, Distribution dist)
 Creates a new random variate generator from the distribution dist, using stream s.
double nextDouble ()
 Generates a random number from the continuous distribution contained in this object.
void nextArrayOfDouble (double[] v, int start, int n)
 Generates n random numbers from the continuous distribution contained in this object.
double[] nextArrayOfDouble (int n)
 Generates n random numbers from the continuous distribution contained in this object, and returns them in a new array of size n.
RandomStream getStream ()
 Returns the umontreal.ssj.rng.RandomStream used by this generator.
void setStream (RandomStream stream)
 Sets the umontreal.ssj.rng.RandomStream used by this generator to stream.
String toString ()
 Returns a String containing information about the current generator.

Static Public Member Functions

static int nextInt (RandomStream s, double theta)
 Uses stream s to generate a new variate from the logarithmic distribution with parameter \(\theta=\) theta.

Detailed Description

This class implements random variate generators for the (discrete) logarithmic distribution.

Its mass function is

\[ p(x) = \frac{-\theta^x}{x \log(1 - \theta)} \qquad\mbox{ for } x = 1,2,…, \tag{flogar} \]

where \(0 < \theta<1\). It uses inversion with the LS chop-down algorithm if \(\theta< \theta_0\) and the LK transformation algorithm if \(\theta\ge\theta_0\), as described in [100] . The threshold \(\theta_0\) can be specified when invoking the constructor. Its default value is \(\theta_0 = 0.96\), as suggested in [100] .

  A local copy of the parameter @f$\theta@f$ is maintained in this class.

  <div class="SSJ-bigskip"></div>

Definition at line 51 of file LogarithmicGen.java.

Constructor & Destructor Documentation

◆ LogarithmicGen() [1/4]

umontreal.ssj.randvar.LogarithmicGen.LogarithmicGen ( RandomStream s,
double theta )

Creates a logarithmic random variate generator with parameters.

\(\theta= \) theta and default value \(\theta_0 = 0.96\), using stream s.

Definition at line 65 of file LogarithmicGen.java.

◆ LogarithmicGen() [2/4]

umontreal.ssj.randvar.LogarithmicGen.LogarithmicGen ( RandomStream s,
double theta,
double theta0 )

Creates a logarithmic random variate generator with parameters.

\(\theta= \) theta and \(\theta_0 = \mathtt{theta0}\), using stream s.

Definition at line 75 of file LogarithmicGen.java.

◆ LogarithmicGen() [3/4]

umontreal.ssj.randvar.LogarithmicGen.LogarithmicGen ( RandomStream s,
LogarithmicDist dist )

Creates a new generator with distribution dist and stream s, with default value \(\theta_0 = 0.96\).

Definition at line 86 of file LogarithmicGen.java.

◆ LogarithmicGen() [4/4]

umontreal.ssj.randvar.LogarithmicGen.LogarithmicGen ( RandomStream s,
LogarithmicDist dist,
double theta0 )

Creates a new generator with distribution dist and stream s, with \(\theta_0 = \mathtt{theta0}\).

Definition at line 94 of file LogarithmicGen.java.

Member Function Documentation

◆ getTheta()

double umontreal.ssj.randvar.LogarithmicGen.getTheta ( )

Returns the \(\theta\) associated with this object.

Definition at line 164 of file LogarithmicGen.java.

◆ getTheta0()

double umontreal.ssj.randvar.LogarithmicGen.getTheta0 ( )

Returns the \(\theta_0\) associated with this object.

Definition at line 171 of file LogarithmicGen.java.

◆ nextInt() [1/2]

int umontreal.ssj.randvar.LogarithmicGen.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

Reimplemented from umontreal.ssj.randvar.RandomVariateGenInt.

Definition at line 111 of file LogarithmicGen.java.

◆ nextInt() [2/2]

int umontreal.ssj.randvar.LogarithmicGen.nextInt ( RandomStream s,
double theta )
static

Uses stream s to generate a new variate from the logarithmic distribution with parameter \(\theta=\) theta.

Definition at line 122 of file LogarithmicGen.java.


The documentation for this class was generated from the following file: