How do we sample uniformly at random from the unit dimensional simplex? It turns out there is an easy way to do it: generate i.i.d. uniform variables in [0,1] and let denote the k-th smallest among them. Then,
is a desired sample from the unit simplex
. It is straight-forward to prove now the claim and implement the method. However, there is a more efficient approach, based on the following exercise:
Exercise 1: Let be i.i.d. exponential random variables and define
. Prove that
is uniformly distributed in the
dimensional unit simplex
.
As this paper explains in detail, the former method time whereas the second
. Here is also a visualization of samples from the 2-simplex using a simple script.