This is part of a question I had asked elsewhere, and then some of the links redirected me to CS stack exchange.Given $a_1,\dots,a_D$ (all strictly positive), I want to draw points uniformly from  $\qquad X =\{(x_1, x_2, ..., x_D) \mid 0 \leq x_1 \leq x_2 \leq \dots \leq x_D\leq 1, \sum_{i=1}^D a_i x_i  = 1 \} $How do I achieve this? I would also like to understand how $x_1$ might be distributed over $[\frac {1} {\sum_i a_i}, \frac {1} {a_1}$] (a theoretical query).This question solves it for $a_i=1$ and without the $x_i$'s having a prior order, but I do not see any obvious way to generalize from that answer.There is a similar question on MO, but without the weights $a_1,\dots,a_D$.
Uniform sampling from general simplex with a twist
algorithms;randomness;sampling