Example #1
0
  static Collection<EndPoint> randomEndPoints(Node caller, int total) {

    Set<EndPoint> res = new HashSet<EndPoint>();

    if (seeds.isEmpty()) res.add(nodes.randomElement().endpoint);
    else
      while (res.size() < Math.min(total, seeds.size())) {
        res.add(seeds.randomElement().endpoint);
      }

    seeds.add(caller);
    return res;
  }
Example #2
0
 static int size() {
   return nodes.size();
 }