added dice roll
Some checks failed
CI / general_module_workflow_php (push) Has been cancelled

This commit is contained in:
Dennis Eichhorn 2024-08-16 04:09:29 +02:00
parent 250f64556d
commit a480f4712f

View File

@ -27,6 +27,8 @@ final class GeometricDistribution
/** /**
* Constructor. * Constructor.
* *
* Example: dice roll
*
* @since 1.0.0 * @since 1.0.0
* @codeCoverageIgnore * @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. * Get probability mass function.
* *