Suppose that I want to create in `R` a binary tree on the interval `(0,1)` with maximum depth `3` in the following way:

First we have a pool of potential cut-offs for the tree `t=c(0.1,0.2,0.3,0.4,0.5,0.6,0.7)`, a cut-off means that if we randomly choose the value `0.4` then we split the interval `(0,1)` to `(0,0.4)` and `(0.4,1)`.

The steps that I want to do are:

1)Start with the whole interval `(0,1)`

2)Randomly choose a cut-off from `t`, denoted as `t_1`

3)Split the interval `(0,1)` based on the chosen cut-off i.e. to subintervals `(0,t_1)` and `(t_1,1)`

4)Then randomly choose one of the intervals `(0,t_1)` and `(t_1,1)`

5)For the chosen interval randomly sample from the cut-offs a point `t_2` that makes sense, i.e. a point that it is not outside of the interval

6)Continue the procedure up to the point where we reach the maximum depth.

I'm totally clueless on where how to start. Is this the right forum to post such a question?