def WeightedDistribution(elements, count):

  def FindY(x, total):
    return total * math.pow(x, -0.408506)

  total = len(elements)
  picks = []
  picked = {}
  offset = FindY(total, total)
  max_repeat = MaxRepeatCount(elements, count)
  attempts = 0
  while len(picks) < count:
    attempts += 1
    # avoid dead-lock
    if attempts > (count * 4):
      break
    x = random.random() * total
    y = FindY(x, total) - offset
    index = abs(int(y))
    if index < total:
      if picked.get(index, 0) < max_repeat:
        picks.append(elements[index])
        picked[index] = picked.get(index, 0) + 1
#        print '%s: %s' % (index, elements[index])
  return picks
Retrieves the certificate used to sign the bounce message.
dataset/ETHPy150Open catap/namebench/libnamebench/selectors.py/WeightedDistribution--crossover with--dataset/ETHPy150Open django-ses/django-ses/django_ses/utils.py/BounceMessageVerifier.certificate