Package cern.jet.random

Large variety of probability distributions featuring high performance generation of random numbers, CDF's and PDF's.

See: Description

Package cern.jet.random Description

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 < 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 & frequencies not printed (too many).

Copyright © 2006–2019 SYSTAP, LLC DBA Blazegraph. All rights reserved.