I have found an answer (this) showing how to generate random numbers that add up to a number, but I need those numbers to be less that 100. How might I go about this?
2026-03-26 01:06:18.1774487178
Generating 5 random numbers less than 100 that add up to a number, 180 for example
690 Views Asked by Bumbble Comm https://math.techqa.club/user/bumbble-comm/detail At
1
The problem is when you slice cube $[0,100]^5$ with hyperplane $\sum X_i=180$, you will no longer get a simplex, but instead get a truncated simplex. The most practical thing to do here is to use the algorithm from your link to generate the 5 numbers that add up to 180 until all of them less than 100. The probability to reject the point will be $$ p = 5\left(\frac{180-100}{180}\right)^4 = 0.195 $$ so your algorithm will be slower by 25% on average, which is not that bad.