@Nullable
        Weighted select0(int currentSequence) {
            if (candidates.isEmpty()) {
                return null;
            }

            if (weighted) {
                final long numberCandidates = candidates.size();

                final long mod = Math.abs(currentSequence % totalWeight);

                if (mod < accumulatedGroups.get(0).accumulatedWeight) {
                    return candidates.get((int) (mod % numberCandidates));
                }

                int left = 0;
                int right = accumulatedGroups.size() - 1;
                int mid;
                while (left < right) {
                    mid = left + ((right - left) >> 1);

                    if (mid == left) {
                        break;
                    }

                    if (accumulatedGroups.get(mid).accumulatedWeight <= mod) {
                        left = mid;
                    } else {
                        right = mid;
                    }
                }

                // (left + 1) is the part where sequence belongs
                final long indexInPart = mod - accumulatedGroups.get(left).accumulatedWeight;
                final long startIndex = accumulatedGroups.get(left + 1).startIndex;
                return candidates.get((int) (startIndex + indexInPart % (numberCandidates - startIndex)));
            }

            return candidates.get(Math.abs(currentSequence % candidates.size()));
        }
A weighted round robin select strategy.

<p>For example, with node a, b and c:
<ul>
  <li>if endpoint weights are 1,1,1 (or 2,2,2), then select result is abc abc ...</li>
  <li>if endpoint weights are 1,2,3 (or 2,4,6), then select result is abcbcc(or abcabcbcbccc) ...</li>
  <li>if endpoint weights are 3,5,7, then select result is abcabcabcbcbccc abcabcabcbcbccc ...</li>
</ul>
core/src/main/java/com/linecorp/armeria/common/loadbalancer/WeightedRoundRobinLoadBalancer.java