/** Roll a subset of the contained dice. */
  @Override
  public void roll() {
    int oldRollCounter = currentRollCounter;
    currentRollCounter = increment(currentRollCounter);

    java.util.Collection<Integer> diceToRoll =
        DiceDataUtil.getFlippedBits(oldRollCounter, currentRollCounter);

    // Roll any necessary dice, deciding whether to roll
    // based on which bit positions in the binary counter
    // have flipped.
    for (int dieNum : diceToRoll) {
      diceList.get(dieNum).roll();
    }
  }
 /**
  * @param rangeSize The total range of values that should be rollable.
  * @param numberOfDice The number of dice across which the range should be divided.
  * @param gen The random number generator to provide to all contained dice.
  */
 BinaryRollCountingDiceAggregator(int rangeSize, int numberOfDice, java.util.Random gen) {
   diceList = DiceDataUtil.getDice(rangeSize, numberOfDice, gen);
   maxRollCounter = 1 << numberOfDice;
   maxRollableValue = rangeSize;
 }