|
SoftNet-Consult Java Utility Library | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.softnetConsult.utils.random.Poisson
public class Poisson
Creates Poisson-distributed pseudorandom numbers.
This product includes software developed by the
SoftNet-Consult Java Utility Library project and its contributors.
(http://java-tools.sourceforge.net)
Copyright (c) 2007-2008 SoftNet-Consult.
Copyright (c) 2007-2008 G. Paperin.
All rights reserved.
File: Poisson.java
Library API version: "2.02"
Java compliance version: "1.5"
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following terms and conditions are met:
1. Redistributions of source code must retain the above
acknowledgement of the SoftNet-Consult Java Utility Library project, the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above acknowledgement of the
SoftNet-Consult Java Utility Library project, the above copyright notice, this list of
conditions and the following disclaimer in the documentation and/or other materials
provided with the distribution.
3. All advertising materials mentioning features or use of this software or any derived
software must display the following acknowledgement:
This product includes software developed by the SoftNet-Consult Java Utility Library
project and its contributors.
THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS, CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Field Summary | |
---|---|
static double |
DEFAULT_EPSILON
Default value for epsilon when no other value is specified. |
private double |
epsilon
Specifies the completeness of the CDF table - the table is calculated until the approximated CDF value reaches 1.0 - epsilon . |
private double |
lambda
The lambda parameter of this Poisson distribution. |
private java.util.Random |
rndSource
The source of uniformly independently distributed random numbers. |
private double[] |
table
The CDF table. |
Constructor Summary | |
---|---|
Poisson(double lambda)
Creates a generator for Poisson distributed random numbers with the specified lambda-parameter. |
|
Poisson(double lambda,
java.util.Random rndSource)
Creates a generator for Poisson distributed random numbers with the specified lambda-parameter and the specified source of random numbers. |
|
Poisson(double lambda,
java.util.Random rndSource,
double epsilon)
Creates a generator for Poisson distributed random numbers. |
Method Summary | |
---|---|
double |
getEpsilon()
The epsilon value used during the calculation of the CDF table. |
double |
getLambda()
Returns expected mean and variance of this Poisson distribution. |
int |
nextRandom()
Generates a new (pseudo-) random integer number from this Poisson-distribution. |
private int |
tableSearch(double dice)
Used internally to look up the value of the inverse of the cumulative distribution function of the Poisson distribution. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final double DEFAULT_EPSILON
private double epsilon
1.0 - epsilon
.
private double lambda
private double[] table
private java.util.Random rndSource
Constructor Detail |
---|
public Poisson(double lambda)
Poisson(lambda, new Random(), Poisson.DEFAULT_EPSILON)
.
lambda
- The LAMBDA-parameter to the Poisson distribution.Poisson(double, Random, double)
public Poisson(double lambda, java.util.Random rndSource)
Poisson(lambda, rndSource, Poisson.DEFAULT_EPSILON)
.
lambda
- The LAMBDA-parameter to the Poisson distribution.rndSource
- The source of uniformly independently distributed (pseudo-) random numbers to use for
this distribution.Poisson(double, Random, double)
public Poisson(double lambda, java.util.Random rndSource, double epsilon)
lambda
- The LAMBDA parameter for this Poisson distribution.
Both, the mean and the variance of a Poisson-distributed random variable are equal to lambda
.rndSource
- The source of uniformly independently distributed (pseudo-) random numbers to use for
this distribution.epsilon
- Completeness threshold used during the computation of the cumulative distribution function
table. The CDF table is calculated until the approximated CDF value reaches 1.0 - epsilon
.Method Detail |
---|
public double getLambda()
public double getEpsilon()
1.0 - epsilon
.public int nextRandom()
private int tableSearch(double dice)
dice
- A number in interval [0, 1]
dice
<= CDF(k),
where CDF is the cumulative distribution function of this Poisson distribution.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |