public void run() {

    while (!stop) {
      Integer newInt = rand.nextInt(Parameters.range);
      int coin = rand.nextInt(1000);
      if (coin < cdf[0]) { // 1. should we run a writeAll operation?

        // init a collection
        Vector<Integer> vec = new Vector<Integer>(newInt);
        vec.add(newInt / 2); // accepts duplicate

        try {
          if (bench.removeAll(vec)) numRemoveAll++;
          else failures++;
        } catch (Exception e) {
          System.err.println(
              "Unsupported writeAll operations! Leave the default value of the numWriteAlls parameter (0).");
        }

      } else if (coin < cdf[1]) { // 2. should we run a writeSome
        // operation?

        if (2 * (coin - cdf[0]) < cdf[1] - cdf[0]) { // add
          if (bench.addInt((int) newInt)) {
            numAdd++;
          } else {
            failures++;
          }
        } else { // remove
          if (bench.removeInt((int) newInt)) {
            numRemove++;
          } else failures++;
        }

      } else if (coin < cdf[2]) { // 3. should we run a readAll operation?

        bench.size();
        numSize++;

      } else { // 4. then we should run a readSome operation

        if (bench.containsInt((int) newInt)) numContains++;
        else failures++;
      }
      total++;

      assert total
          == failures + numContains + numSize + numRemove + numAdd + numRemoveAll + numAddAll;
    }
    this.getCount = CompositionalMap.counts.get().getCount;
    this.nodesTraversed = CompositionalMap.counts.get().nodesTraversed;
    this.structMods = CompositionalMap.counts.get().structMods;
    System.out.println("Thread #" + myThreadNum + " finished.");
  }
 public void printDataStructure() {
   System.out.println(bench.toString());
 }