Non biased return a list of n random positive numbers (>=0) so that their sum == total_sum

Why not just generate the right number of uniformly distributed random numbers, tot them up and scale ?

EDIT: To be a bit clearer: you want N numbers which sum to S ? So generate N uniformly distributed random numbers on the interval [0,1) or whatever your RNG produces. Add them up, they will total s (say) whereas you want them to total S, so multiply each number by S/s. Now the numbers are uniformly randomly distributed on [0,S/s) I think.

Leave a Comment