Make chooseReplicas independent of map iteration order.