Just a quick question here: I created a matrix full of random numbers in which each row sums to 100. However, it includes negative numbers. I would like it so that the matrix only includes positive numbers between 0 and 100 in each row.
I have tried the following function:
matrix <- t(replicate(30,{x <- runif(3, 0, 50); y <- c(x, 100 - sum(x)); sample(y/sum(y) * 100)}))
I tried changing the min, which should be equal to 0 right now (and the max is 50), but that didn't work. What am I missing?
Thank you in advance.