It feels it is very easy but I spent the last half an hour trying to find a solution.
What I need to do is to randomly generate/sample the vector (x,y,z)
that is a probability mass function, i.e., 0 <= x,y,z <= 1
and x + y + z = 1
. And such a vector should be uniformly distributed among all the vectors satisfying the conditions.
In other words, consider the set S = { (x,y,z) | 0 <= x,y,z <= 1, x+y+z = 1 }
. I need to uniformly sample from this set.
UPD: one should use Dirichlet distribution with all alpha[i] = 1
.