Remix.run Logo
Malipeddi a day ago

There are other quite elegent methods for triangle and simplices.

For a triangle, drawing α and β uniform over [0,1) the barycentric coordinates given by (1-sqrt(α), sqrt(alpha)(1-β), βsqrt(alpha)) is uniform over the triangle. No rejection and no test for flipping.

For simplices (triangle, tetrahedron, 5-cell etc) barycentric coordinates obtained by drawing uniformly from (0,1] taking a log and normalizing will be uniform within the simplex.

I wrote about this and other related sampling below.

https://abhila.sh/writing/5/Random_Sampling.html

https://abhila.sh/writing/8/Random_Sampling_2.html