Skip to content

Commit

Permalink
Issue #10: Do not use a formula to compute the count.
Browse files Browse the repository at this point in the history
  • Loading branch information
drupol committed May 29, 2018
1 parent ff8a6e9 commit 318097b
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/Iterators/Combinations.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,13 @@ public function valid()
*/
public function count()
{
return $this->fact(count($this->getDataset())) /
($this->fact($this->getLength()) * $this->fact(count($this->getDataset()) - $this->getLength()));
$i = 0;

for ($this->rewind(); $this->valid(); $this->next()) {
$i++;
}

return $i;
}

/**
Expand Down

0 comments on commit 318097b

Please sign in to comment.