The trick is in defining "random" in the face of the three apparently
incompatible constraints that the numbers be random, that they sum to 1,
and that they be uniformly distributed.  Tell us more.  Perhaps extend
Peter D's solution by first deciding (at random) how many components
each solution will have.

Ben Fairbank

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of sun
Sent: Tuesday, October 10, 2006 8:28 AM
To: [email protected]
Subject: [R] generate random numbers that sum up to 1

I am trying to generate a vector of random numbers with the constraint
that they have to sum up to one with uniform distribution.

eg. {0.1,0.7,0.2 }

any function to do this? Thanks.

______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to