I need to generate 3 discrete random variables whose sum is equal to a specified value (fixed) and is uniformly distributed, however each component of the sum has specified bounds. For example, $$ X_1 + X_2 + X_3 = S $$ where $a_1 \leq X_1 \leq b_1$, $a_2 \leq X_2 \leq b_2$, and $a_3 \leq X_3 \leq b_3$.

I found this Random Vectors with Fixed Sum, but it only allows a single bound to be given that then applies to all the $X$s.


Make it more general!

  1. Generate a random $X_1$ value between $a_1$ and $b_1$;
  2. Generate a random $X_2$ value between $a_2$ and $b_2$;
  3. Compute $X_3$ as $S - X_1 - X_2$ and check whether the generated number belongs to the interval $a_3$ and $b_3$. If the value belongs to the interval return the three generated values, restart from step 1. otherwise

You can extend the algorithm to a generic $R^n$ space


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.