Minor mistake in code sample
GaryHuan9 opened this issue · comments
In section 16.4.2.3 Hierarchical Transformation (p233), the first code sample is missing a curly braces between line 8 and 9 to close off the else statement:
1 node = root;
2 while (!node.isLeaf) {
3 if (u < node.probLeft) {
4 u /= node.probLeft;
5 node = node.left;
6 } else {
7 u /= (1.0 - node.probLeft);
8 node = node.right;
9 }
10 // Ok. We have found a leaf with the correct probability!
Should be:
1 node = root;
2 while (!node.isLeaf) {
3 if (u < node.probLeft) {
4 u /= node.probLeft;
5 node = node.left;
6 } else {
7 u /= (1.0 - node.probLeft);
8 node = node.right;
9 } <<<<<<<<<<<<<<<<<<<<< Missing this
10 }
11 // Ok. We have found a leaf with the correct probability!