diff --git a/Math/Stochastic/Distribution/GeometricDistribution.php b/Math/Stochastic/Distribution/GeometricDistribution.php index df96ff874..fa5b8a7a4 100755 --- a/Math/Stochastic/Distribution/GeometricDistribution.php +++ b/Math/Stochastic/Distribution/GeometricDistribution.php @@ -27,6 +27,8 @@ final class GeometricDistribution /** * Constructor. * + * Example: dice roll + * * @since 1.0.0 * @codeCoverageIgnore */ @@ -34,6 +36,14 @@ final class GeometricDistribution { } + /** + * How often to roll to get a specific value with at least percent chance + */ + public static function getHowOften(float $p, float $percent) : float + { + return log(1.0 - $percent) / log(1 - $p); + } + /** * Get probability mass function. *