if( n.getChildCount() == 0 ) return null;
  protected MarkableBaseNode doGetRandomNode( int pos, MarkableBaseNode n,int markMask,     MarkableBaseNode forbiddenTree ) {    if( n == null || n == forbiddenTree )      throw new IllegalArgumentException("n==null or recursed into forbidden tree");    if( pos == SCAN_UNMARKED ) {      if( (n.getMark() & markMask) == 0 )        return n;      else {        MarkableBaseNode found = null;        for( int i=0;i<n.getChildCount() && found == null;i++) {          MarkableBaseNode child = (MarkableBaseNode) n.getChild(i);          if( child != forbiddenTree )            found = doGetRandomNode(pos,child,markMask,forbiddenTree);        }        return found;      }    }    pos--;    if( pos == 0 ) {      if( (n.getMark() & markMask) != 0 )        return doGetRandomNode(SCAN_UNMARKED,n,markMask, forbiddenTree);      else        return n;    }    int stSize = 0;    MarkableBaseNode child= null;    for( int i=0;i<n.getChildCount() && pos>0;i++) {      child = ((MarkableBaseNode) n.getChild(i));      stSize = child == forbiddenTree ? 0 : child.getSubteeSize();      pos-= stSize;    }    if( child == null )      System.err.println("ARGH! pos="+(pos+stSize));    return doGetRandomNode( pos + stSize, child, markMask, forbiddenTree );  }