Class DistGeometric
java.lang.Object
nl.tudelft.simulation.jstats.distributions.Dist
nl.tudelft.simulation.jstats.distributions.DistDiscrete
nl.tudelft.simulation.jstats.distributions.DistGeometric
The Geometric distribution. The geometric distribution is the only discrete memoryless random distribution. It is a discrete
analog of the exponential distribution. There are two variants, one that indicates the number of Bernoulli trials to get the
first success (1, 2, 3, ...), and one that indicates the number of failures before the first success (0, 1, 2, ...). In line
with Law & Kelton, the version of the number of failures before the first success is modeled here, so X ={0, 1, 2, ...}.
For more information on this distribution see
https://mathworld.wolfram.com/GeometricDistribution.html
Copyright (c) 2002-2025 Delft University of Technology, Jaffalaan 5, 2628 BX Delft, the Netherlands. All rights reserved. See for project information DSOL Manual. The DSOL project is distributed under a three-clause BSD-style license, which can be found at DSOL License.
- Author:
- Peter Jacobs , Alexander Verbraeck
-
Field Summary
-
Constructor Summary
ConstructorsConstructorDescriptionDistGeometric(StreamInterface stream, double p) Construct a new geometric distribution for a repeated set of Bernoulli trials, indicating the number of failures before the first success. -
Method Summary
Modifier and TypeMethodDescriptionlongdraw()draws the next long from the stream.doublegetP()Return the probability of success for each individual trial.doubleprobability(long observation) returns the probability of the observation in this particular distribution.toString()
-
Constructor Details
-
DistGeometric
Construct a new geometric distribution for a repeated set of Bernoulli trials, indicating the number of failures before the first success.- Parameters:
stream- the random number streamp- the probability of success for each individual trial- Throws:
IllegalArgumentException- when p <= 0 or p >= 1
-
-
Method Details
-
draw
public long draw()Description copied from class:DistDiscretedraws the next long from the stream.- Specified by:
drawin classDistDiscrete- Returns:
- long
-
probability
public double probability(long observation) Description copied from class:DistDiscretereturns the probability of the observation in this particular distribution.- Specified by:
probabilityin classDistDiscrete- Parameters:
observation- the discrete observation.- Returns:
- double the probability.
-
getP
public double getP()Return the probability of success for each individual trial.- Returns:
- the probability of success for each individual trial
-
toString
-