GeometricDistribution
Represents the geometric distribution, which models the number of failures before the first success in a series of independent Bernoulli trials.
This distribution uses the 0-indexed convention: k = 0 means success occurred on the very first trial (zero failures), k = 1 means one failure before the first success, and so on. The support is {0, 1, 2, ...} (all non-negative integers).
The geometric distribution is memoryless -- the probability of needing at least m more failures is the same regardless of how many failures have already occurred. It is also a special case of the negative binomial distribution with successes = 1.
Common applications include modeling the number of defective items inspected before finding a good one, the number of unsuccessful sales calls before a sale, or the number of coin flips before landing heads.
Example:
val dist = GeometricDistribution(probability = 0.3)
dist.pmf(0) // 0.3 (success on first trial)
dist.pmf(2) // 0.147 (two failures, then success)
dist.cdf(3) // 0.7599 (at most 3 failures)
dist.mean // 2.3333 (expected number of failures)
dist.quantileInt(0.5) // 2 (median number of failures)
dist.sample(Random(42)) // a single random drawProperties
The Shannon entropy of this distribution in nats. Returns zero when probability is 1.0 (degenerate case).
the probability of success on each trial. Must be in (0, 1].