[R] Sampe numbers

Frederic Ntirenganya
2016-07-19T17:41:06Z

Hi Guys,
I am trying to sample 100 numbers from 1:100
i did it  like this:

sample(1:100,100, replace= TRUE)
but i want again include a constraint that their sum must be equal to 50

How could I do it?

Cheers