umontreal.iro.lecuyer.randvar
Class HypergeometricGen
- java.lang.Object
-
- umontreal.iro.lecuyer.randvar.RandomVariateGen
-
- umontreal.iro.lecuyer.randvar.RandomVariateGenInt
-
- umontreal.iro.lecuyer.randvar.HypergeometricGen
-
public class HypergeometricGen extends RandomVariateGenInt
This class implements random variate generators for the hypergeometric distribution. Its mass function isp(x) = nCr(m, x)nCr(l - m, k - x)/nCr(l, k) for x = max(0, k - l + m),..., min(k, m)where nCr(n, x) is the number of possible combinations when choosing x elements among a set of n elements, m, l and k are integers that satisfy 0 < m <= l and 0 < k <= l.The generation method is inversion using the chop-down algorithm
-
-
Constructor Summary
Constructors Constructor and Description HypergeometricGen(RandomStream s, HypergeometricDist dist)Creates a new generator for distribution dist, using stream s.HypergeometricGen(RandomStream s, int m, int l, int k)Creates a hypergeometric generator with parameters m = m, l = l and k = k, using stream s.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description intgetK()Returns the k associated with this object.intgetL()Returns the l associated with this object.intgetM()Returns the m associated with this object.static intnextInt(RandomStream s, int m, int l, int k)Generates a new variate from the hypergeometric distribution with parameters m = m, l = l and k = k, using stream s.-
Methods inherited from class umontreal.iro.lecuyer.randvar.RandomVariateGenInt
getDistribution, nextArrayOfInt, nextInt
-
Methods inherited from class umontreal.iro.lecuyer.randvar.RandomVariateGen
getStream, nextArrayOfDouble, nextDouble, setStream, toString
-
-
-
-
Constructor Detail
-
HypergeometricGen
public HypergeometricGen(RandomStream s, int m, int l, int k)
Creates a hypergeometric generator with parameters m = m, l = l and k = k, using stream s.
-
HypergeometricGen
public HypergeometricGen(RandomStream s, HypergeometricDist dist)
Creates a new generator for distribution dist, using stream s.
-
-
Method Detail
-
nextInt
public static int nextInt(RandomStream s, int m, int l, int k)
Generates a new variate from the hypergeometric distribution with parameters m = m, l = l and k = k, using stream s.
-
getM
public int getM()
Returns the m associated with this object.
-
getL
public int getL()
Returns the l associated with this object.
-
getK
public int getK()
Returns the k associated with this object.
-
-
DMelt 3.0 © DataMelt by jWork.ORG