0

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.

  • What programming language are you using? – Peter O. Nov 25 '19 at 12:06
  • @PeterO. the language does not matter for me. Basically, anything will work. (Unless very exotic) I am checking now that Dirichlet distribution. It also seems nobody in the answers there cared much about the vector to be truely uniform over the aforementioned set S. – Yauhen Yakimenka Nov 25 '19 at 12:54

0 Answers0