int uts_numChildren(Node *node) { int numChildren = 0; // determine the number of children if (node->height == 0) numChildren = (int) floor(b_0); else { // distribution is identical everywhere below root int v = rng_rand(node->state.state); double d = rng_toProb(v); numChildren = (d < nonLeafProb) ? nonLeafBF : 0; } // limit number of children (only a BIN root can have more than MAXNUMCHILDREN) if (node->height != 0) { if (numChildren > MAXNUMCHILDREN) { bots_debug("*** Number of children truncated from %d to %d\n", numChildren, MAXNUMCHILDREN); numChildren = MAXNUMCHILDREN; } } /* including info into node */ node->numChildren = numChildren; return numChildren; }
int uts_numChildren_bin(Node * parent) { // distribution is identical everywhere below root int v = rng_rand(parent->state.state); double d = rng_toProb(v); return (d < nonLeafProb) ? nonLeafBF : 0; }