public StringBuilder set(Node<Node<?, ?>, Node<?, ?>> set) {
   boolean leftIsToken = g.get.token.compute(set.left);
   boolean rightIsToken = g.get.token.compute(set.right);
   // If neither (or both) sides are terminals, just pick a random side
   if (leftIsToken == rightIsToken) {
     return flip(set);
   }
   // Randomly pick the nonterminal side a limited number of times.
   int number = rand.nextInt(3) + 1;
   if (number <= 2) {
     depthLimit -= number;
   }
   if (!leftIsToken) {
     if (number <= 2 && depthLimit >= 0) {
       Node.accept(this, set.left);
     } else {
       Node.accept(this, set.right);
     }
   } else if (!rightIsToken) {
     if (number <= 2 && depthLimit >= 0) {
       Node.accept(this, set.right);
     } else {
       Node.accept(this, set.left);
     }
   }
   //		System.out.format("left %s : token? %b\n", g.get.printer.compute(set.left), leftIsToken);
   //		System.out.format("right %s : token? %b\n", g.get.printer.compute(set.right), rightIsToken);
   return buffer;
 }
 private StringBuilder flip(Node<Node<?, ?>, Node<?, ?>> set) {
   if (rand.nextInt(2) == 0) {
     Node.accept(this, set.left);
   } else {
     Node.accept(this, set.right);
   }
   return buffer;
 }
 public StringBuilder list(Node<Node<?, ?>, Node<?, ?>> language) {
   Node.accept(this, language.left);
   Node.accept(this, language.right);
   return buffer;
 }
 public StringBuilder loop(Node<Node<?, ?>, Node<?, ?>> language) {
   for (int iterations = rand.nextInt(loopLimit); iterations > 0; iterations--) {
     Node.accept(this, language.left);
   }
   return buffer;
 }
 public StringBuilder rule(Node<Node<String, Void>, Node<?, ?>> rule) {
   Node.accept(this, rule.right);
   return buffer;
 }