Class Zipf
java.lang.Object
random.AbstractDistribution
random.discrete.DiscreteDistribution
random.discrete.Zipf
- All Implemented Interfaces:
StorableDistribution
Zipf distribution, used to model popularity skews in the JMT simulation engine.
-
Field Summary
Fields inherited from class DiscreteDistribution
cached, CDFList, CDFListCalculatedFields inherited from class AbstractDistribution
engine -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondoublecdf(int x) doubleobtain the cumulative distribution from the distributionintgetlower()intgetUpper()intnextRand()These functions are used to direct initialize the Discrete Distribution.intGenerate random variables that follow an probability distributionvoidoutdated()Set all cache flag false, call it when parameters changed.doublepmf(int x) doubleobtain the probability distribution from the distributiondoubledoubleCalculate the Mean value from the parameter of the distributiondoubledoubleCalculate the Variance from the parameter of the distributionbooleanupdatePar(double alpha, int numberOfElements) booleanSub-class must implement this method to update parameter.Methods inherited from class DiscreteDistribution
binarySearch, createdCDFList, createdCDFList, inverseTransformSamplingMethods inherited from class AbstractDistribution
setRandomEngine
-
Constructor Details
-
Zipf
public Zipf() -
Zipf
-
Zipf
-
Zipf
-
-
Method Details
-
updatePar
public boolean updatePar(double alpha, int numberOfElements) throws IncorrectDistributionParameterException -
updatePar
Description copied from class:DiscreteDistributionSub-class must implement this method to update parameter.- Specified by:
updateParin classDiscreteDistribution- Throws:
IncorrectDistributionParameterException
-
outdated
public void outdated()Description copied from class:DiscreteDistributionSet all cache flag false, call it when parameters changed.- Overrides:
outdatedin classDiscreteDistribution
-
getUpper
public int getUpper()- Specified by:
getUpperin classDiscreteDistribution
-
getlower
public int getlower()- Specified by:
getlowerin classDiscreteDistribution
-
nextRand
public int nextRand()Description copied from class:DiscreteDistributionThese functions are used to direct initialize the Discrete Distribution. once invoke parameter constructor with the distribution parameter, set cached = true. if not cache the parameter, only method with `Parameter` are available.- Specified by:
nextRandin classDiscreteDistribution
-
pmf
public double pmf(int x) - Specified by:
pmfin classDiscreteDistribution
-
cdf
public double cdf(int x) - Specified by:
cdfin classDiscreteDistribution
-
theorMean
public double theorMean()- Specified by:
theorMeanin classDiscreteDistribution
-
theorVariance
public double theorVariance()- Specified by:
theorVariancein classDiscreteDistribution
-
nextRand
Description copied from class:DiscreteDistributionGenerate random variables that follow an probability distribution- Specified by:
nextRandin classDiscreteDistribution- Parameters:
p- parameter of the distribution.- Returns:
- int - random variables that follow an probability distribution
- Throws:
IncorrectDistributionParameterException
-
pmf
Description copied from class:DiscreteDistributionobtain the probability distribution from the distribution- Specified by:
pmfin classDiscreteDistribution- Parameters:
x- int - random variable indicating where to evaluate the pmf.p- parameter of the distribution.- Returns:
- double - the probability weight evaluated at x.
- Throws:
IncorrectDistributionParameterException
-
cdf
Description copied from class:DiscreteDistributionobtain the cumulative distribution from the distribution- Specified by:
cdfin classDiscreteDistribution- Parameters:
x- int - random variable indicating where to evaluate the cdf.p- parameter of the distribution.- Returns:
- double - the probability weight cumulated at x.
- Throws:
IncorrectDistributionParameterException
-
theorMean
Description copied from class:DiscreteDistributionCalculate the Mean value from the parameter of the distribution- Specified by:
theorMeanin classDiscreteDistribution- Parameters:
p- parameter of the distribution.- Returns:
- double - theoretic mean value of the distribution.
- Throws:
IncorrectDistributionParameterException
-
theorVariance
Description copied from class:DiscreteDistributionCalculate the Variance from the parameter of the distribution- Specified by:
theorVariancein classDiscreteDistribution- Parameters:
p- parameter of the distribution.- Returns:
- double - theoretic variance value of the distribution.
- Throws:
IncorrectDistributionParameterException
-