# The Living Thing / Notebooks : The simplex

The space of convex combinations of things. Hacks for it.

## Simulating uniformly from the simplex

This one is apparently “folk wisdom”.

But say you wish to simulate a vector drawn uniformly from the $$n$$-simplex.

1. simulate $$n$$ random uniform variables on the unit interval, $$(u_1,_u_2,\dots,u_n)$$
2. Sort them in decreasing order, $$(u'_1,_u'_2,\dots,u'_n)$$
3. Your random vector is $$(u'_1-0, u'_2-u'_1, u'_3-u'_2,\dots,u'_n-u'_{n-1})$$

### Refs

Frie08
Friedman, G. (2008) An elementary illustrated introduction to simplicial sets. arXiv:0809.4221 [Math].