I am trying to generate random numbers (weights) using Monte Carlo simulation using R. I would like to have 10000 simulation replications, generating weights for 13 variables. I am trying the following code
mcrep = 10000 # Simulation replications n = 13 # number of variables to which we will assign weights weights = rexp(n * mcrep) # Simulate standard exponential data
But I want to add a constraint; each set of weights should sum to one. Could anybody help? (based on this or any other code)