# create random random whose sum is constant

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.

• You have one less degree of freedom since given $k-1$ of the $r_i$'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. – M.B. Oct 29 '13 at 9:53
• Dear M.B. Thank you for your reply, but what does this imply? Can we then safely say that the nk numbers are indistinguishable? That said, can a person reconstruct the values of n from these nk values, given that he knows nothing about how the n(k-1) random values are constructed? Thanks alot :) – SaSa Oct 29 '13 at 11:16
• I'm not really sure I understand what you mean here. Do you want $k$ numbers such that every element of $N$ can be represented as a sum of $r_i$'s? – M.B. Oct 29 '13 at 12:11
• I think your first answer does answer my question. Thanks alot M.B. :) – SaSa Nov 5 '13 at 11:15

## 1 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.

• Actually you can loose many more degrees of freedom than only one ... generally a constraint will have effect on the probability distribution as well – randomatlabuser Nov 5 '13 at 11:36