protected function MatchBase::binom in Password Strength 8.2
Calculate binomial coefficient (n choose k).
http://www.php.net/manual/en/ref.math.php#57895
Parameters
$n:
$k:
Return value
int
File
- src/
MatchBase.php, line 141
Class
Namespace
Drupal\password_strengthCode
protected function binom($n, $k) {
$j = $res = 1;
if ($k < 0 || $k > $n) {
return 0;
}
if ($n - $k < $k) {
$k = $n - $k;
}
while ($j <= $k) {
$res *= $n--;
$res /= $j++;
}
return $res;
}