create random random whose sum is constant

698 Views Asked by At

Given N numbers. How can I decompose each element x in N into random values r1,r2,..rk (k can be a variable) such that the their sum is equal to x. What can we do if the rs are integers or irrationals or real numbers (maybe from zero to one)?

Note that the random values should not be differentiated from the pool of all decomposed values.

Hope anyone can help me out!

Thanks.

1

There are 1 best solutions below

1
On BEST ANSWER

M.B. helped in answering my question. The answer goes as follows

You have one less degree of freedom since given k−1 of the ri's you have completely determined the last one. E.g. you can just draw k−1 random numbers and define the last one such that the sum condition is satisfied.

Thanks a lot.