Package cern.jet.random
package cern.jet.random
Large variety of probability distributions featuring high performance generation of random numbers, CDF's and PDF's. You can always do a quick and dirty check to test the properties of any given distribution, for example, as follows:
// Gamma distribution // define distribution parameters double mean = 5; double variance = 1.5; double alpha = mean*mean / variance; double lambda = 1 / (variance / mean); // for tests and debugging use a random engine with CONSTANT seed --> deterministic and reproducible results cern.jet.random.engine.RandomEngine engine = new cern.jet.random.engine.MersenneTwister(); // your favourite distribution goes here cern.jet.random.AbstractDistribution dist = new cern.jet.random.Gamma(alpha,lambda,engine); // collect random numbers and print statistics int size = 100000; cern.colt.list.DoubleArrayList numbers = new cern.colt.list.DoubleArrayList(size); for (int i=0; i invalid input: '<' size; i++) numbers.add(dist.nextDouble()); hep.aida.bin.DynamicBin1D bin = new hep.aida.bin.DynamicBin1D(); bin.addAllOf(numbers); System.out.println(bin); Will print something like Size: 100000 Sum: 499830.30147620925 SumOfSquares: 2648064.0189520954 Min: 1.2903021480010035 Max: 12.632626684290546 Mean: 4.998303014762093 RMS: 5.14593433591228 Variance: 1.497622138362513 Standard deviation: 1.2237737284165373 Standard error: 0.0038699123224725817 Geometric mean: 4.849381516061957 Product: Infinity Harmonic mean: 4.69916104903662 Sum of inversions: 21280.394299425236 Skew: 0.49097523334186227 Kurtosis: 0.3461005384481113 Sum of powers(3): 1.4822908764628284E7 Sum of powers(4): 8.741360251658581E7 Sum of powers(5): 5.41658186456702E8 Sum of powers(6): 3.5183920126086535E9 Moment(0,0): 1.0 Moment(1,0): 4.998303014762093 Moment(2,0): 26.480640189520955 Moment(3,0): 148.22908764628284 Moment(4,0): 874.1360251658581 Moment(5,0): 5416.58186456702 Moment(6,0): 35183.92012608654 Moment(0,mean()): 1.0 Moment(1,mean()): 3.7017002796346785E-14 Moment(2,mean()): 1.4976071621409774 Moment(3,mean()): 0.8998351672510565 Moment(4,mean()): 7.50487543880015 Moment(5,mean()): 14.413483695698101 Moment(6,mean()): 77.72119325586715 25%, 50%, 75% Quantiles: 4.122365795016783, 4.897730017566362, 5.763097174551738 quantileInverse(median): 0.500005 Distinct elements invalid input: '&' frequencies not printed (too many). |
-
ClassesClassDescriptionAbstract base class for all continous distributions.Abstract base class for all discrete distributions.Abstract base class for all random distributions.Benchmarks random number generation from various distributions as well as PDF and CDF lookups.Beta distribution; math definition and animated definition.Binomial distribution; See the math definition and animated definition.BreitWigner (aka Lorentz) distribution; See the math definition.Mean-square BreitWigner distribution; See the math definition.ChiSquare distribution; See the math definition and animated definition.Contains methods for conveniently generating pseudo-random numbers from special distributions such as the Burr, Cauchy, Erlang, Geometric, Lambda, Laplace, Logistic, Weibull, etc.Empirical distribution.Discrete Empirical distribution (pdf's can be specified).Exponential Distribution (aka Negative Exponential Distribution); See the math definition animated definition.Exponential Power distribution.Contains various mathematical helper methods.Hyperbolic distribution.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.Logarithmic distribution.Negative Binomial distribution; See the math definition.Normal (aka Gaussian) distribution; See the math definition and animated definition.Poisson distribution (quick); See the math definition and animated definition.Poisson distribution; See the math definition and animated definition.Not yet commented.StudentT distribution (aka T-distribution); See the math definition and animated definition.Uniform distribution; Math definition and animated definition.Von Mises distribution.Zeta distribution.