Generate the next sample by randomly flipping two adjacent candidates.

        :ivar list<int> V: Contains integer representations of each candidate in order of their
            ranking in a vote, from first to last. This is the current sample.

def getNextSample(self, V):
        """
        Generate the next sample by randomly flipping two adjacent candidates.

        :ivar list<int> V: Contains integer representations of each candidate in order of their
            ranking in a vote, from first to last. This is the current sample.
        """

        # Select a random alternative in V to switch with its adacent alternatives.
        randPos = random.randint(0, len(V)-2)
        W = copy.deepcopy(V)
        d = V[randPos]
        c = V[randPos+1]
        W[randPos] = c
        W[randPos+1] = d

        # Check whether we should change to the new ranking.
        prMW = 1
        prMV = 1
        prob = min(1.0,(prMW/prMV)*pow(self.phi, self.wmg[d][c]))/2
        if random.random() <= prob:
            V = W
    
        return V