|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectsim.util.distribution.AbstractDistribution
sim.util.distribution.AbstractDiscreteDistribution
sim.util.distribution.HyperGeometric
public class HyperGeometric
HyperGeometric distribution; See the math definition The hypergeometric distribution with parameters N, n and s is the probability distribution of the random variable X, whose value is the number of successes in a sample of n items from a population of size N that has s 'success' items and N - s 'failure' items.
p(k) = C(s,k) * C(N-s,n-k) / C(N,n) where C(a,b) = a! / (b! * (a-b)!).
valid for N >= 2, s,n <= N.
Instance methods operate on a user supplied uniform random number generator; they are unsynchronized.
Implementation: High performance implementation. Patchwork Rejection/Inversion method.
H. Zechner (1994): Efficient sampling from continuous and discrete unimodal distributions, Doctoral Dissertation, 156 pp., Technical University Graz, Austria.
Field Summary | |
---|---|
protected int |
my_n
|
protected int |
my_N
|
protected int |
my_s
|
Fields inherited from class sim.util.distribution.AbstractDistribution |
---|
randomGenerator |
Constructor Summary | |
---|---|
HyperGeometric(int N,
int s,
int n,
MersenneTwisterFast randomGenerator)
Constructs a HyperGeometric distribution. |
Method Summary | |
---|---|
protected int |
hmdu(int N,
int M,
int n,
MersenneTwisterFast randomGenerator)
Returns a random number from the distribution. |
protected int |
hprs(int N,
int M,
int n,
MersenneTwisterFast randomGenerator)
Returns a random number from the distribution. |
int |
nextInt()
Returns a random number from the distribution. |
int |
nextInt(int N,
int s,
int n)
Returns a random number from the distribution; bypasses the internal state. |
protected int |
nextInt(int N,
int M,
int n,
MersenneTwisterFast randomGenerator)
Returns a random number from the distribution; bypasses the internal state. |
double |
pdf(int k)
Returns the probability distribution function. |
void |
setState(int N,
int s,
int n)
Sets the parameters. |
java.lang.String |
toString()
Returns a String representation of the receiver. |
Methods inherited from class sim.util.distribution.AbstractDiscreteDistribution |
---|
nextDouble |
Methods inherited from class sim.util.distribution.AbstractDistribution |
---|
apply, apply, getRandomGenerator, setRandomGenerator |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected int my_N
protected int my_s
protected int my_n
Constructor Detail |
---|
public HyperGeometric(int N, int s, int n, MersenneTwisterFast randomGenerator)
Method Detail |
---|
protected int hmdu(int N, int M, int n, MersenneTwisterFast randomGenerator)
protected int hprs(int N, int M, int n, MersenneTwisterFast randomGenerator)
public int nextInt()
nextInt
in class AbstractDiscreteDistribution
public int nextInt(int N, int s, int n)
protected int nextInt(int N, int M, int n, MersenneTwisterFast randomGenerator)
public double pdf(int k)
public void setState(int N, int s, int n)
public java.lang.String toString()
toString
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |