diff --git a/src/Permutation.php b/src/Permutation.php index e8fe5c2..761e0e0 100644 --- a/src/Permutation.php +++ b/src/Permutation.php @@ -122,13 +122,13 @@ public function calculate(): static $baseConverter = new BaseConvert(); $baseConverter->to($this->countItems())->setMinDigits($this->getSelection())->toCharacters($this->getItems()); for ($possibilityId = 0; $possibilityId < $totalPossibilities; $possibilityId++) { + $possibilityArray = $baseConverter->from($possibilityId)->calculate()->getResultArray(); if (!$this->canRepetitions()) { - $possibilityArray = $baseConverter->from($possibilityId)->calculate()->getResultArray(); if( count($possibilityArray) != count(array_unique($possibilityArray)) ){ continue; } } - $this->possibilities[] = $baseConverter->from($possibilityId)->calculate()->getResult(); + $this->possibilities[] = $possibilityArray; } } return $this;