public Tree eenyMeeny (Tree a) {
        int r; count(a);
        Tree node = a;
        int sum;
        do {
            r = gen.nextInt(node.depth);
            if (r == node.depth - 1) return node;
            sum = 0;
            for(Tree f : node.children) {
                sum += f.depth;
                if (r < sum) { 
		    node = f; sum = 0; break;
		}
            }
        } while(sum == 0);
        return node;
    }