Skip to content
Prev 310130 / 398502 Next

how to generate a set of random numbers that sum to 1 with uniform distribution of elements

On Nov 7, 2012, at 10:48 AM, Albyn Jones wrote:

            
Couldn't one just do:

 mat <- matrix(runif(1000*10), ncol=10) # mean value per element = 0.5
mat2 <- mat/rowSums(mat)       # mean value of rowSums= 5