code: def drawRankingPlakettLuce(self, rankList):
          
  
          probs = self.plakettLuceProbs
          numCands = len(rankList)
          newRanking = []
          remainingCands = copy.deepcopy(rankList)
          probsCopy = copy.deepcopy(self.plakettLuceProbs)
          totalProb = sum(probs)
  
          # We will use prob to iteratively calculate the probabilty that we draw the order vector
          # that we end up drawing.
          prob = 1.0
          
          while (len(newRanking) < numCands):
  
              # We generate a random number from 0 to 1, and use it to select a candidate. 
              rand = random.random()
              threshold = 0.0
              for i in range(0, len(probsCopy)):
                  threshold = threshold + probsCopy[i]/totalProb
                  if rand <= threshold:
                      prob = prob * probsCopy[i]/totalProb
                      newRanking.append(remainingCands[i])
                      remainingCands.pop(i)
                      totalProb = totalProb - probsCopy[i]
                      probsCopy.pop(i)
                      break
  
          return newRanking, prob
docs: Given an order vector over the candidates, draw candidates to generate a new order vector.
  
          :ivar list<int> rankList: Contains integer representations of each candidate in order of their
              rank in a vote, from first to last.