Generating uniformly distributed random solutions of a linear equation Given $n+1$ variables $p_0, p_1, \ldots, p_n$ defined over $\mathbb{R}^{+}$ so that $\sum_{i=0}^np_i=1$, and given a real number $1<x<n$, I want to generate random solutions of the equation so that every solution is equiprobable (or close enough to be equiprobable) $$
0p_0 + 1p_1+\ldots+np_n=x
$$
Since all variables are real numbers, the number of solutions is infinite, but I don't know how to algorithmically choose any of them randomly in an (at least close to) uniform way
NOTE: In case it's needed, suppose I have a method $g(a, b)$ that, when called, returns a random real number between $a$ and $b$.
Possible solution: (I strongly suspect this is a solution far from being uniform). Generate $n$ random real numbers $r_i$ defined in the interval 0 to 1. They will represent coefficients of $x$ so that $ip_i=xr_i$ (since $0p_0=0$ add nothing I don't need to generate $r_0$). That means $\sum r_i$ must be equal to $1$. To make that happen, generate all the $r_i$ randomly as said, but if $\sum r_i=k\neq 1$, multiply each $r_i$ by $1/k$.
Assign $p_i=xr_i/i$ and $p_0=1-\sum_{i=1}^np_i$. For the sum of all $p_i$ to be equal to $1$ is required that $$
\frac{r_1}{1}+\frac{r_2}{2}+\ldots+\frac{r_n}{n}\leq\frac{1}{x}
$$
but I don't know if that's guaranteed or not and, even if it's guaranteed, I suspect the generated solution might not be choosen uniformely because $p_0$ is deterministically calculated.

The intersection of the $n+1$ simplex
$$\{\mathbf{p}\in\mathbb R_+^{n+1};\ \mathbf{p}^\top\mathbf 1_{n+1}=1\}$$
when $\mathbf 1_{n+1}=(1,\ldots1)^\top$ and of the constrained hyperplane
$$\{\mathbf{p}\in\mathbb R_+^{n+1};\ \mathbf{p}^\top\mathbf \iota_{n+1}=x\}$$
when $\iota_{n+1}=(0,1,\ldots n)^\top$ is within a $(n−1)$-dimensional affine space
$$\{\mathbf{p}\in\mathbb R_+^{n+1};\ A\mathbf p=b\}\tag{1}$$
where $A$ is a $(2,n+1)$ matrix whose rows are orthonormal (wlog).
If $\mathbf p^0$ is a particular solution, i.e., a particular element of (1), the other members will be of the form $\mathbf p^0+\eta$ with $A\eta=0$, which can be expressed via an orthonormal basis of vectors satisfying $A\eta=0$. It is then sufficient to find an hypercube containing (1) by finding upper and lower bounds on the components of $\eta$ in (1), to generate uniformly points in that hypercube and accept simulations such that $\mathbf p^0+\eta\in\mathbb R_+^{n+1}$
