umontreal.iro.lecuyer.randvar
Class LogarithmicGen
- java.lang.Object
-
- umontreal.iro.lecuyer.randvar.RandomVariateGen
-
- umontreal.iro.lecuyer.randvar.RandomVariateGenInt
-
- umontreal.iro.lecuyer.randvar.LogarithmicGen
-
public class LogarithmicGen extends RandomVariateGenInt
This class implements random variate generators for the (discrete) logarithmic distribution. Its mass function isp(x) = -θx/x log(1-θ) for x = 1, 2,…,where 0 < θ < 1. It uses inversion with the LS chop-down algorithm if θ < θ0 and the LK transformation algorithm if θ >= θ0, as described in. The threshold θ0 can be specified when invoking the constructor. Its default value is θ0 = 0.96, as suggested in.A local copy of the parameter θ is maintained in this class.
-
-
Constructor Summary
Constructors Constructor and Description LogarithmicGen(RandomStream s, double theta)Creates a logarithmic random variate generator with parameters θ = theta and default value θ0 = 0.96, using stream s.LogarithmicGen(RandomStream s, double theta, double theta0)Creates a logarithmic random variate generator with parameters θ = theta and θ0 =theta0 , using stream s.LogarithmicGen(RandomStream s, LogarithmicDist dist)Creates a new generator with distribution dist and stream s, with default value θ0 = 0.96.LogarithmicGen(RandomStream s, LogarithmicDist dist, double theta0)Creates a new generator with distribution dist and stream s, with θ0 =theta0 .
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description doublegetTheta()Returns the θ associated with this object.doublegetTheta0()Returns the θ0 associated with this object.intnextInt()Generates a random number (an integer) from the discrete distribution contained in this object.static intnextInt(RandomStream s, double theta)Uses stream s to generate a new variate from the logarithmic distribution with parameter θ = theta.-
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
-
-
-
-
Constructor Detail
-
LogarithmicGen
public LogarithmicGen(RandomStream s, double theta)
Creates a logarithmic random variate generator with parameters θ = theta and default value θ0 = 0.96, using stream s.
-
LogarithmicGen
public LogarithmicGen(RandomStream s, double theta, double theta0)
Creates a logarithmic random variate generator with parameters θ = theta and θ0 =theta0 , using stream s.
-
LogarithmicGen
public LogarithmicGen(RandomStream s, LogarithmicDist dist)
Creates a new generator with distribution dist and stream s, with default value θ0 = 0.96.
-
LogarithmicGen
public LogarithmicGen(RandomStream s, LogarithmicDist dist, double theta0)
Creates a new generator with distribution dist and stream s, with θ0 =theta0 .
-
-
Method Detail
-
nextInt
public int nextInt()
Description copied from class:RandomVariateGenIntGenerates 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:
nextIntin classRandomVariateGenInt- Returns:
- the generated value
-
nextInt
public static int nextInt(RandomStream s, double theta)
Uses stream s to generate a new variate from the logarithmic distribution with parameter θ = theta.
-
getTheta
public double getTheta()
Returns the θ associated with this object.
-
getTheta0
public double getTheta0()
Returns the θ0 associated with this object.
-
-
DMelt 3.0 © DataMelt by jWork.ORG