# Uniformly distributed n-dimensional probability vectors

What's the right way to generate a random probability vector $p={p_1,\ldots,p_n} \in {(0,1)}^n$ where $\sum_i p_i=1$, uniformly distributed over the $(n-1)$-dimensional simplex?

What I have is

Intervals = Table[{0, 1}, {i, n}]
RandomPoint := Block[{a},
a = RandomVariate[UniformDistribution[Intervals]];
a/Total[a]];

But I am unsure that this is correct. In particular, I'm unsure that it's any different from:

RandomPoint := Block[{a},
a = Table[Random[], {i, n}];
a/Total[a]];

And the latter clearly will not distribute vectors uniformly. Is the first code the right one?

-
This question may be relevant. –  Sjoerd C. de Vries Oct 8 '13 at 11:21
Thanks, @SjoerdC.deVries. That question seems to suggest that my first code is also incorrect? I'm assuming that that bunch of smart guys would have stumbled upon it. –  Schiphol Oct 8 '13 at 11:42
Perhaps DirichletDistribution might help? –  chuy Oct 8 '13 at 14:03
That question involved points on a sphere. Your constraint of $\sum{p_i}=1$ is different. –  Sjoerd C. de Vries Oct 8 '13 at 14:39
I agree with chuy. From wikipedia: Dirichlet Distribution‌​, we have: "When alpha = 1, the symmetric Dirichlet distribution is equivalent to a uniform distribution over the open standard K-1-simplex, i.e. it is uniform over all points in its support". Using DirichletDistribution is most likely then also the best implementation for most purposes. –  Jacob Akkerboom Oct 8 '13 at 15:26