tree = {
new_tree;
let p = 0.7;
let root = { depth: 0, children: [], blah: 0 };
let cnt = 1;
let max_depth = 0;
let stack = [root];
while (stack.length > 0 && cnt < 10000) {
let node = stack.pop();
let depth = node.depth;
for (let i = 0; i < 3; i++) {
if (d3.randomUniform(0, 1)() < p ** node.depth) {
cnt = cnt + 1;
let child = { depth: node.depth + 1, children: [] };
node.children.push(child);
stack.push(child);
if (child.depth > max_depth) {
max_depth = child.depth;
}
}
}
}
return root;
}