@Nonnull
  @Override
  public Iterator<T> getIterator(int unused)
  {
    List<T> hosts = new ArrayList<>(_cumulativePointsMap.values());
    if (!hosts.isEmpty())
    {
      Collections.shuffle(hosts);
      //we try to put host with higher probability as the first by calling get. This avoids the situation where unhealthy host is returned first.
      try
      {
        Collections.swap(hosts, 0, hosts.indexOf(get(0)));
      } catch (IndexOutOfBoundsException e)
      {
        LOG.warn("Got indexOutOfBound when trying to shuffle list:" + e.getMessage());
      }
    }
    return hosts.iterator();
  }
@Test
  public void testLowProbabilityHost() throws Exception {
    Map<URI, Integer> pointsMap = new HashMap<>();
    Map<URI, Integer> countsMap = new HashMap<>();

    List<URI> goodHosts = addHostsToPointMap(9, 100, pointsMap);
    List<URI> slowStartHost = addHostsToPointMap(1, 1, pointsMap);
    Ring<URI> ring = new DistributionNonDiscreteRingFactory<URI>().createRing(pointsMap);
    List<URI> results = new ArrayList<>();
    Iterator<URI> iter = ring.getIterator(0);
    long startTime = System.currentTimeMillis();
    while (iter.hasNext()) {
      results.add(iter.next());
    }
    long endTime = System.currentTimeMillis();
    long duration = endTime - startTime;
    Assert.assertTrue(results.size() == 10);
  }