src/gburtini/Distributions/Binomial.php
public function icdf($p)
    {
        if ($p < 0 || $p > 1) {
            throw new \InvalidArgumentException("Parameter (\$p = " . var_export($p, true) . " must be between 0 and 1. ");
        }
        if ($p == 1) {
            return INF;
        }
        $accumulator = 0.0;
        $k = 0;
        do {
            $delta = $this->pdf($k);
            $accumulator = $accumulator + $delta;
            if ($accumulator >= $p) {
                return $k;
            }
            $k = $k + 1;
        } while ($k < $this->n);
        return $k;
    }
public function icdf($p)
    {
        if ($p < 0 || $p > 1) {
            throw new \InvalidArgumentException("Parameter (\$p = " . var_export($p, true) . " must be between 0 and 1. ");
        }
        if ($p == 1) {
            return INF;
        }
        $accumulator = 0.0;
        $k = 0;
        do {
            $delta = $this->pdf($k);
            $accumulator = $accumulator + $delta;
            if ($accumulator >= $p) {
                return $k;
            }
            $k = $k + 1;
        } while ($k < $this->n);
        return $k;
    }
public function icdf ( $ p ) { if ( $ p < 0 || $ p > 1 ) { throw new \ InvalidArgumentException ( "Parameter (\$p = " . var_export ( $ p , true ) . " must be between 0 and 1. " ) ; } if ( $ p == 1 ) { return INF ; } $ accumulator = 0.0 ; $ k = 0 ; do { $ delta = $ this -> pdf ( $ k ) ; $ accumulator = $ accumulator + $ delta ; if ( $ accumulator >= $ p ) { return $ k ; } $ k = $ k + 1 ; } while ( $ k < $ this -> n ) ; return $ k ; }
Again, not a very efficient implementation
Again not a very efficient implementation