mardi 27 février 2018

Random Sampling in R to give an exact sum

I want to sample 140 numbers between 1000 to 100000 such that the sum of these 140 numbers is around 2 million (2000000)

sample(1000:100000,140) such that sum(sample(1000:100000,140)) = 2000000

Any pointers how can I achieve this?




Aucun commentaire:

Enregistrer un commentaire