Package repast.simphony.random
Class DefaultRandomRegistry
java.lang.Object
repast.simphony.random.DefaultRandomRegistry
- All Implemented Interfaces:
RandomRegistry
A registry that stores random number generators.
- Author:
- Jerry Vos
-
Field Summary
FieldsFields inherited from interface repast.simphony.random.RandomRegistry
DEFAULT_GENERATOR -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncern.jet.random.BetacreateBeta(double alpha, double beta) Creates the default beta distribution using the default random number generator.cern.jet.random.BinomialcreateBinomial(int n, double p) Creates the default binomial distribution using the default random number generator.cern.jet.random.BreitWignercreateBreitWigner(double mean, double gamma, double cut) Creates the default Breit Wigner distribution using the default random number generator.cern.jet.random.BreitWignerMeanSquarecreateBreitWignerMeanSquareState(double mean, double gamma, double cut) Creates the default Breit Wigner mean square state distribution using the default random number generator.cern.jet.random.ChiSquarecreateChiSquare(double freedom) Creates the default chi square distribution using the default random number generator.cern.jet.random.EmpiricalcreateEmpirical(double[] pdf, int interpolationType) Creates the default empirical distribution using the default random number generator.cern.jet.random.EmpiricalWalkercreateEmpiricalWalker(double[] pdf, int interpolationType) Creates the default empirical walker distribution using the default random number generator.cern.jet.random.ExponentialcreateExponential(double lambda) Creates the default exponential distribution using the default random number generator.cern.jet.random.ExponentialPowercreateExponentialPower(double tau) Creates the default exponential power distribution using the default random number generator.cern.jet.random.GammacreateGamma(double alpha, double lambda) Creates the default gamma distribution using the default random number generator.cern.jet.random.HyperboliccreateHyperbolic(double alpha, double beta) Creates the default hyperbolic distribution using the default random number generator.cern.jet.random.HyperGeometriccreateHyperGeometric(int N, int s, int n) Creates the default hyper geometric distribution using the default random number generator.cern.jet.random.LogarithmiccreateLogarithmic(double p) Creates the default logarithmic distribution using the default random number generator.cern.jet.random.NegativeBinomialcreateNegativeBinomial(int n, double p) Creates the default negative binomial distribution using the default random number generator.cern.jet.random.NormalcreateNormal(double mean, double standardDeviation) Creates the default normal distribution using the default random number generator.cern.jet.random.PoissoncreatePoisson(double mean) Creates the default Poisson distribution using the default random number generator.cern.jet.random.PoissonSlowcreatePoissonSlow(double mean) Creates the default slower Poisson distribution using the default random number generator.cern.jet.random.StudentTcreateStudentT(double freedom) Creates the default StudentT distribution using the default random number generator.cern.jet.random.UniformCreates the default Unifrom distribution using the default random number generator.cern.jet.random.UniformcreateUniform(double min, double max) Creates the default uniform distribution using the default random number generator.cern.jet.random.VonMisescreateVonMises(double freedom) Creates a default VonMises distribution using the default random number generator.cern.jet.random.ZetacreateZeta(double ro, double pk) Creates the default Zeta distribution using the default random number generator.cern.jet.random.BetagetBeta()Gets the default beta distribution.cern.jet.random.BinomialGets the default binomial distribution.cern.jet.random.BreitWignerGets the default BreitWigner distribution.cern.jet.random.BreitWignerMeanSquareGets the default BreitWignerMeanSquare distribution.cern.jet.random.ChiSquareGets the default Zeta distribution.cern.jet.random.AbstractDistributiongetDistribution(String name) Gets the named previously registered distribution.cern.jet.random.EmpiricalGets the default ChiSquare distribution.cern.jet.random.EmpiricalWalkerGets the default EmpiricalWalker distribution.cern.jet.random.ExponentialGets the default Exponential distribution.cern.jet.random.ExponentialPowerGets the default exponentialPower distribution.cern.jet.random.GammagetGamma()Gets the default gamma distribution.cern.jet.random.engine.RandomEnginegetGenerator(String generatorName) Gets a previously registered random number generator.cern.jet.random.HyperbolicGets the default hyperbolic distribution.cern.jet.random.HyperGeometricGets the default hyperGeometric distribution.cern.jet.random.LogarithmicGets the default logarithmic distribution.cern.jet.random.NegativeBinomialGets the default negativeBinomial distribution.cern.jet.random.NormalGets the default normal distribution.cern.jet.random.PoissonGets the default poisson distribution.cern.jet.random.PoissonSlowGets the default slow poisson distribution.intGets the seed of the named generator.cern.jet.random.StudentTGets the default studentT distribution.cern.jet.random.UniformGets the default uniform distribution.cern.jet.random.VonMisesGets the default vonMises distribution.cern.jet.random.ZetagetZeta()Gets the default Zeta distribution.voidregisterDistribution(String name, cern.jet.random.AbstractDistribution dist) Registers the named random number distribution for later retrieval.cern.jet.random.engine.RandomEngineregisterGenerator(String name, int seed) Creates and registers a new random number generator with the specified name and seed.voidreset()Resets this random registry by doing the following: invalidates any live default distributions removes (de-registers) any non-default distributions removes (de-registers) any non-default random number generators creates a new default random number generator with the current time as its seed creates a new default uniform distributionsvoidsetSeed(int seed) Sets the seed for the default random number generator.
-
Field Details
-
defaultSeed
protected int defaultSeed
-
-
Constructor Details
-
DefaultRandomRegistry
public DefaultRandomRegistry()Default constructor
-
-
Method Details
-
registerGenerator
Creates and registers a new random number generator with the specified name and seed. The generator can then be retrieved later using #getGenerator(String).This will create a MersenneTwister for the generator.
- Specified by:
registerGeneratorin interfaceRandomRegistry- Parameters:
name- the name of the generator to create and registerseed- the new generators seed- Returns:
- the new generator itself
-
getGenerator
Gets a previously registered random number generator.- Specified by:
getGeneratorin interfaceRandomRegistry- Parameters:
generatorName- the name of the generator to get- Returns:
- a previously registered random number generator.
-
getSeed
Gets the seed of the named generator.- Specified by:
getSeedin interfaceRandomRegistry- Parameters:
generatorName- the name of the generator- Returns:
- the seed of the named generator.
-
registerDistribution
Registers the named random number distribution for later retrieval.- Specified by:
registerDistributionin interfaceRandomRegistry- Parameters:
name- the name of the distributiondist- the distribution to register
-
getDistribution
Gets the named previously registered distribution. Calling code can then cast the distribution into the appropriate type (e.g. a Normal).- Specified by:
getDistributionin interfaceRandomRegistry- Parameters:
name- the name of the distribution to get- Returns:
- the named previously registered distribution.
-
createZeta
public cern.jet.random.Zeta createZeta(double ro, double pk) Creates the default Zeta distribution using the default random number generator.- Specified by:
createZetain interfaceRandomRegistry- Parameters:
ro-pk-- Returns:
- the created distribution
-
getZeta
public cern.jet.random.Zeta getZeta()Gets the default Zeta distribution.- Specified by:
getZetain interfaceRandomRegistry- Returns:
- the default Zeta distribution.
-
createVonMises
public cern.jet.random.VonMises createVonMises(double freedom) Creates a default VonMises distribution using the default random number generator.- Specified by:
createVonMisesin interfaceRandomRegistry- Parameters:
freedom-- Returns:
- the created distribution
-
createUniform
public cern.jet.random.Uniform createUniform(double min, double max) Creates the default uniform distribution using the default random number generator.- Specified by:
createUniformin interfaceRandomRegistry- Parameters:
min-max-- Returns:
- the created distribution
-
createUniform
public cern.jet.random.Uniform createUniform()Creates the default Unifrom distribution using the default random number generator.- Specified by:
createUniformin interfaceRandomRegistry- Returns:
- the created distribution
-
createStudentT
public cern.jet.random.StudentT createStudentT(double freedom) Creates the default StudentT distribution using the default random number generator.- Specified by:
createStudentTin interfaceRandomRegistry- Parameters:
freedom-- Returns:
- the created distribution
-
createPoissonSlow
public cern.jet.random.PoissonSlow createPoissonSlow(double mean) Creates the default slower Poisson distribution using the default random number generator.- Specified by:
createPoissonSlowin interfaceRandomRegistry- Parameters:
mean-- Returns:
- the created distribution
-
createPoisson
public cern.jet.random.Poisson createPoisson(double mean) Creates the default Poisson distribution using the default random number generator.- Specified by:
createPoissonin interfaceRandomRegistry- Parameters:
mean-- Returns:
- the created distribution
-
createNormal
public cern.jet.random.Normal createNormal(double mean, double standardDeviation) Creates the default normal distribution using the default random number generator.- Specified by:
createNormalin interfaceRandomRegistry- Parameters:
mean-standardDeviation-- Returns:
- the created distribution
-
createNegativeBinomial
public cern.jet.random.NegativeBinomial createNegativeBinomial(int n, double p) Creates the default negative binomial distribution using the default random number generator.- Specified by:
createNegativeBinomialin interfaceRandomRegistry- Parameters:
n-p-- Returns:
- the created distribution
-
createLogarithmic
public cern.jet.random.Logarithmic createLogarithmic(double p) Creates the default logarithmic distribution using the default random number generator.- Specified by:
createLogarithmicin interfaceRandomRegistry- Parameters:
p-- Returns:
- the created distribution
-
createHyperGeometric
public cern.jet.random.HyperGeometric createHyperGeometric(int N, int s, int n) Creates the default hyper geometric distribution using the default random number generator.- Specified by:
createHyperGeometricin interfaceRandomRegistry- Parameters:
N-s-n-- Returns:
- the created distribution
-
createHyperbolic
public cern.jet.random.Hyperbolic createHyperbolic(double alpha, double beta) Creates the default hyperbolic distribution using the default random number generator.- Specified by:
createHyperbolicin interfaceRandomRegistry- Parameters:
alpha-beta-- Returns:
- the created distribution
-
createGamma
public cern.jet.random.Gamma createGamma(double alpha, double lambda) Creates the default gamma distribution using the default random number generator.- Specified by:
createGammain interfaceRandomRegistry- Parameters:
alpha-lambda-- Returns:
- the created distribution
-
createExponentialPower
public cern.jet.random.ExponentialPower createExponentialPower(double tau) Creates the default exponential power distribution using the default random number generator.- Specified by:
createExponentialPowerin interfaceRandomRegistry- Parameters:
tau-- Returns:
- the created distribution
-
createExponential
public cern.jet.random.Exponential createExponential(double lambda) Creates the default exponential distribution using the default random number generator.- Specified by:
createExponentialin interfaceRandomRegistry- Parameters:
lambda-- Returns:
- the created distribution
-
createEmpiricalWalker
public cern.jet.random.EmpiricalWalker createEmpiricalWalker(double[] pdf, int interpolationType) Creates the default empirical walker distribution using the default random number generator.- Specified by:
createEmpiricalWalkerin interfaceRandomRegistry- Parameters:
pdf-interpolationType-- Returns:
- the created distribution
-
createEmpirical
public cern.jet.random.Empirical createEmpirical(double[] pdf, int interpolationType) Creates the default empirical distribution using the default random number generator.- Specified by:
createEmpiricalin interfaceRandomRegistry- Parameters:
pdf-interpolationType-- Returns:
- the created distribution
-
createChiSquare
public cern.jet.random.ChiSquare createChiSquare(double freedom) Creates the default chi square distribution using the default random number generator.- Specified by:
createChiSquarein interfaceRandomRegistry- Parameters:
freedom-- Returns:
- the created distribution
-
createBreitWignerMeanSquareState
public cern.jet.random.BreitWignerMeanSquare createBreitWignerMeanSquareState(double mean, double gamma, double cut) Creates the default Breit Wigner mean square state distribution using the default random number generator.- Specified by:
createBreitWignerMeanSquareStatein interfaceRandomRegistry- Parameters:
mean-gamma-cut-- Returns:
- the created distribution
-
createBreitWigner
public cern.jet.random.BreitWigner createBreitWigner(double mean, double gamma, double cut) Creates the default Breit Wigner distribution using the default random number generator.- Specified by:
createBreitWignerin interfaceRandomRegistry- Parameters:
mean-gamma-cut-- Returns:
- the created distribution
-
createBinomial
public cern.jet.random.Binomial createBinomial(int n, double p) Creates the default binomial distribution using the default random number generator.- Specified by:
createBinomialin interfaceRandomRegistry- Parameters:
n-p-
-
createBeta
public cern.jet.random.Beta createBeta(double alpha, double beta) Creates the default beta distribution using the default random number generator.- Specified by:
createBetain interfaceRandomRegistry- Parameters:
alpha-beta-- Returns:
- the created distribution
-
getBeta
public cern.jet.random.Beta getBeta()Gets the default beta distribution.- Specified by:
getBetain interfaceRandomRegistry- Returns:
- the default beta distribution.
-
getBinomial
public cern.jet.random.Binomial getBinomial()Gets the default binomial distribution.- Specified by:
getBinomialin interfaceRandomRegistry- Returns:
- the default binomial distribution.
-
getBreitWigner
public cern.jet.random.BreitWigner getBreitWigner()Gets the default BreitWigner distribution.- Specified by:
getBreitWignerin interfaceRandomRegistry- Returns:
- the default BreitWigner distribution.
-
getBreitWignerMeanSquare
public cern.jet.random.BreitWignerMeanSquare getBreitWignerMeanSquare()Gets the default BreitWignerMeanSquare distribution.- Specified by:
getBreitWignerMeanSquarein interfaceRandomRegistry- Returns:
- the default BreitWignerMeanSquare distribution.
-
getChiSquare
public cern.jet.random.ChiSquare getChiSquare()Gets the default Zeta distribution.- Specified by:
getChiSquarein interfaceRandomRegistry- Returns:
- the default Zeta distribution.
-
getEmpirical
public cern.jet.random.Empirical getEmpirical()Gets the default ChiSquare distribution.- Specified by:
getEmpiricalin interfaceRandomRegistry- Returns:
- the default ChiSquare distribution.
-
getEmpiricalWalker
public cern.jet.random.EmpiricalWalker getEmpiricalWalker()Gets the default EmpiricalWalker distribution.- Specified by:
getEmpiricalWalkerin interfaceRandomRegistry- Returns:
- the default EmpiricalWalker distribution.
-
getExponential
public cern.jet.random.Exponential getExponential()Gets the default Exponential distribution.- Specified by:
getExponentialin interfaceRandomRegistry- Returns:
- the default Exponential distribution.
-
getExponentialPower
public cern.jet.random.ExponentialPower getExponentialPower()Gets the default exponentialPower distribution.- Specified by:
getExponentialPowerin interfaceRandomRegistry- Returns:
- the default exponentialPower distribution.
-
getGamma
public cern.jet.random.Gamma getGamma()Gets the default gamma distribution.- Specified by:
getGammain interfaceRandomRegistry- Returns:
- the default gamma distribution.
-
getHyperbolic
public cern.jet.random.Hyperbolic getHyperbolic()Gets the default hyperbolic distribution.- Specified by:
getHyperbolicin interfaceRandomRegistry- Returns:
- the default hyperbolic distribution.
-
getHyperGeometric
public cern.jet.random.HyperGeometric getHyperGeometric()Gets the default hyperGeometric distribution.- Specified by:
getHyperGeometricin interfaceRandomRegistry- Returns:
- the default hyperGeometric distribution.
-
getLogarithmic
public cern.jet.random.Logarithmic getLogarithmic()Gets the default logarithmic distribution.- Specified by:
getLogarithmicin interfaceRandomRegistry- Returns:
- the default logarithmic distribution.
-
getNegativeBinomial
public cern.jet.random.NegativeBinomial getNegativeBinomial()Gets the default negativeBinomial distribution.- Specified by:
getNegativeBinomialin interfaceRandomRegistry- Returns:
- the default negativeBinomial distribution.
-
getNormal
public cern.jet.random.Normal getNormal()Gets the default normal distribution.- Specified by:
getNormalin interfaceRandomRegistry- Returns:
- the default normal distribution.
-
getPoisson
public cern.jet.random.Poisson getPoisson()Gets the default poisson distribution.- Specified by:
getPoissonin interfaceRandomRegistry- Returns:
- the default poisson distribution.
-
getPoissonSlow
public cern.jet.random.PoissonSlow getPoissonSlow()Gets the default slow poisson distribution.- Specified by:
getPoissonSlowin interfaceRandomRegistry- Returns:
- the default slow poisson distribution.
-
getStudentT
public cern.jet.random.StudentT getStudentT()Gets the default studentT distribution.- Specified by:
getStudentTin interfaceRandomRegistry- Returns:
- the default studentT distribution.
-
getUniform
public cern.jet.random.Uniform getUniform()Gets the default uniform distribution.- Specified by:
getUniformin interfaceRandomRegistry- Returns:
- the default uniform distribution.
-
getVonMises
public cern.jet.random.VonMises getVonMises()Gets the default vonMises distribution.- Specified by:
getVonMisesin interfaceRandomRegistry- Returns:
- the default vonMises distribution.
-
setSeed
public void setSeed(int seed) Sets the seed for the default random number generator. Any previously created default distributions will be invalidated.- Specified by:
setSeedin interfaceRandomRegistry- Parameters:
seed- the new seed
-
reset
public void reset()Resets this random registry by doing the following:- invalidates any live default distributions
- removes (de-registers) any non-default distributions
- removes (de-registers) any non-default random number generators
- creates a new default random number generator with the current time as its seed
- creates a new default uniform distributions
- Specified by:
resetin interfaceRandomRegistry
-