src/STV/ElectionRunner.php
protected function eliminateCandidates(array $candidates): int
    {
        $minimumCandidates = $this->getLowestCandidates($candidates);
        $count = count($minimumCandidates);

        // p. 52(2)(b) - the returning officer shall decide, by lot, which of those
        // candidates is to be excluded.
        // We do not look back on previous rounds at all as per p. 52(2)(a)
        $minimumCandidate = $minimumCandidates[(array_rand($minimumCandidates))];

        $this->logger->notice(sprintf('There were %d joint lowest candidates,
            %d was randomly selected to be eliminated', $count, $minimumCandidate->getId()));

        $this->transferEliminatedVotes($minimumCandidate);
        $minimumCandidate->setState(Candidate::DEFEATED);

        return count($minimumCandidates);
    }
protected function eliminateCandidates(array $candidates): int
    {
        $minimumCandidates = $this->getLowestCandidates($candidates);
        $count = count($minimumCandidates);

        // p. 52(2)(b) - the returning officer shall decide, by lot, which of those
        // candidates is to be excluded.
        // We do not look back on previous rounds at all as per p. 52(2)(a)
        $minimumCandidate = $minimumCandidates[(array_rand($minimumCandidates))];

        $this->logger->notice(sprintf('There were %d joint lowest candidates,
            %d was randomly selected to be eliminated', $count, $minimumCandidate->getId()));

        $this->transferEliminatedVotes($minimumCandidate);
        $minimumCandidate->setState(Candidate::DEFEATED);

        return count($minimumCandidates);
    }
protected function eliminateCandidates ( array $ candidates ) : int { $ minimumCandidates = $ this -> getLowestCandidates ( $ candidates ) ; $ count = count ( $ minimumCandidates ) ; // p. 52(2)(b) - the returning officer shall decide, by lot, which of those // candidates is to be excluded. // We do not look back on previous rounds at all as per p. 52(2)(a) $ minimumCandidate = $ minimumCandidates [ ( array_rand ( $ minimumCandidates ) ) ] ; $ this -> logger -> notice ( sprintf ( 'There were %d joint lowest candidates,
            %d was randomly selected to be eliminated' , $ count , $ minimumCandidate -> getId ( ) ) ) ; $ this -> transferEliminatedVotes ( $ minimumCandidate ) ; $ minimumCandidate -> setState ( Candidate :: DEFEATED ) ; return count ( $ minimumCandidates ) ; }
Eliminate the candidate with the lowest number of votes
and reallocated their votes.
p. 51.

@param Candidate[] $candidates Array of active candidates

@return int Number of candidates eliminated
Eliminate the candidate with the lowest number of votes and reallocated their votes . p . 51 .