How od i generate random numbers whose sum is constant?
3 views (last 30 days)
If the numbers are supposed to be >= 0 with precribed sum, a simple method is
n = 100;
s = 10;
Y = -log(rand(1,n));
X = s * Y ./ sum(Y,2)
The justification of log is from the ubiased conditioning probability that I explain here: