I am trying to generate $M$ random numbers which are exponentially distributed and whose sum adds up to $N$ (for simplicity, $N=1$).
I found that the generated numbers are initially exponentially distributed. However, after re-scaling they become uniformly distributed. What is the reason for that? And is there a solution?
Here is the result:
Any suggestions would be greatly appreciated.
P.S. My code written in Matlab:
subplot(121) samples = 10000; lambda = 1; X = -log(rand(samples,2))/lambda; hist(X(:,1),100) subplot(122) X = X./sum(X,2); % re-scaling hist(X(:,1),100)