Skip to main content
2 of 2
Corrected after response
Peter Flom
  • 128.1k
  • 36
  • 184
  • 424

10 random numbers from a standard normal will have mean 0 and thus the sum will be about 0, not 5. If you ignore the "standard" part, you will still not be able to pick 10 random numbers from a normal distribution whose sum is exactly 5. You can get 10 such numbers with sum very close to 5 by e.g.

set.seed(123)
vars <- rnorm(10, 0.5, 0.001)
sum(vars)
vars

and if you make the sd (0.001) even smaller then the sum will tend to be even closer to 5.

Peter Flom
  • 128.1k
  • 36
  • 184
  • 424