Package jasima.core.random.discrete
Class IntHypergeometric
- java.lang.Object
-
- jasima.core.random.continuous.DblSequence
-
- jasima.core.random.discrete.IntSequence
-
- jasima.core.random.discrete.IntDistribution
-
- jasima.core.random.discrete.IntHypergeometric
-
- All Implemented Interfaces:
Serializable,Cloneable
public class IntHypergeometric extends IntDistribution
This class implements a discrete number stream following a Hypergeometric distribution. It has a three parameters: the population size, the number of (possible) successes in the population, and the number of trials/samples.- Author:
- Torsten Hildebrandt
- See Also:
- Hypergeometric distribution (Wikipedia), Hypergeometric distribution (MathWorld), Serialized Form
-
-
Field Summary
-
Fields inherited from class jasima.core.random.continuous.DblSequence
rndGen
-
-
Constructor Summary
Constructors Constructor Description IntHypergeometric()IntHypergeometric(int populationSize, int numberOfSuccesses, int sampleSize)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetNumberOfSuccesses()intgetPopulationSize()intgetSampleSize()protected voidsetDistribution(org.apache.commons.math3.distribution.IntegerDistribution distribution)Sets the discrete distribution to use.voidsetNumberOfSuccesses(int numberOfSuccesses)The number of possible successes in the population.voidsetPopulationSize(int populationSize)The total population size.voidsetSampleSize(int sampleSize)The number of samples taken.StringtoString()-
Methods inherited from class jasima.core.random.discrete.IntDistribution
getDistribution, getNumericalMean, getValueRange, nextInt
-
Methods inherited from class jasima.core.random.discrete.IntSequence
clone, nextDbl
-
Methods inherited from class jasima.core.random.continuous.DblSequence
createStreamDefFromStream, getName, getRndGen, init, max, min, setName, setRndGen
-
-
-
-
Method Detail
-
setDistribution
protected void setDistribution(org.apache.commons.math3.distribution.IntegerDistribution distribution)
Description copied from class:IntDistributionSets the discrete distribution to use.- Overrides:
setDistributionin classIntDistribution
-
toString
public String toString()
- Overrides:
toStringin classIntDistribution
-
getPopulationSize
public int getPopulationSize()
-
setPopulationSize
public void setPopulationSize(int populationSize) throws org.apache.commons.math3.exception.NotStrictlyPositiveExceptionThe total population size.- Parameters:
populationSize- The value for the population size.- Throws:
org.apache.commons.math3.exception.NotStrictlyPositiveException- If the supplied value was<=0.
-
getNumberOfSuccesses
public int getNumberOfSuccesses()
-
setNumberOfSuccesses
public void setNumberOfSuccesses(int numberOfSuccesses) throws org.apache.commons.math3.exception.NumberIsTooLargeExceptionThe number of possible successes in the population.- Parameters:
numberOfSuccesses- The number of successes.- Throws:
org.apache.commons.math3.exception.NumberIsTooLargeException- If the supplied value is larger thanpopulationSize.
-
getSampleSize
public int getSampleSize()
-
setSampleSize
public void setSampleSize(int sampleSize) throws org.apache.commons.math3.exception.NumberIsTooLargeExceptionThe number of samples taken.- Parameters:
sampleSize- The number of trials conducted.- Throws:
org.apache.commons.math3.exception.NumberIsTooLargeException- If the supplied value is larger thanpopulationSize.
-
-