lundi 22 juillet 2019

how to generate random numbers with conditons impose in R?

I would like to generate 500 different combination of a,b,and c meeting the following conditions

  1. a+ b+ c = 1 and
  2. a < b < c

here is a basic sample of generating random numbers, however, I need to generate it based on aforementioned conditions.

Coeff = data.frame(a=runif(500, min = 0, max = 1),
b=runif(500, min = 0, max = 1),
c=runif(500, min = 0, max = 1))




Aucun commentaire:

Enregistrer un commentaire