code: public long nextWeight() {
          if(rangeIndex >= rangeCount) {
              return 0xffffffffL;
          } else {
              /* get the next weight */
              WeightRange range = ranges[rangeIndex];
              long weight = range.start;
              if(--range.count == 0) {
                  /* this range is finished */
                  ++rangeIndex;
              } else {
                  /* increment the weight for the next value */
                  range.start = incWeight(weight, range.length);
                  assert(range.start <= range.end);
              }
  
              return weight;
          }
      }
docs: Given a set of ranges calculated by allocWeights(),
  iterate through the weights.
  The ranges are modified to keep the current iteration state.
  
  @return The next weight in the ranges, or 0xffffffff if there is none left.