Choosing a Point from a Uniform Distribution in a Simplex
To choose a point from a uniform distribution within an n-simplex, we compute n+1 barycentric coordinates as follows.
Choose n numbers independently from the uniform distribution between 0 and 1.
Add 0 and 1 to that set.
Sort these n+2 numbers giving {x0, x1, …, xn+1} so that 0≤i≤n → xi ≤ xi+1 and x0 = 0 and xn+1 = 1.
For 0≤i≤n yi = xi+1 − xi.
Σ yi = 1 and we take the y’s to be the barycentric coordinates of our random point.
This trick is used here.