By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,109 Members | 932 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,109 IT Pros & Developers. It's quick & easy.

gen n random numbers sum to 1

P: n/a
Hello,
I want a sequence of n random numbers whose sum is 1. ( There need not
be any uniform or any particular distribution).

Need it for my project related to probabilities.

Thank you.
Regards,
Prakhar.

Jun 12 '07 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Prakhar wrote:
Hello,
I want a sequence of n random numbers whose sum is 1. ( There need not
be any uniform or any particular distribution).

Need it for my project related to probabilities.
Generate n (positive) random numbers, and divide each one of them by
their sum.

Regards,

Zeppe
Jun 12 '07 #2

P: n/a
Thanks.
That really solved the game !! :)

Prakhar.
On Jun 12, 11:32 am, Zeppe
<zep_p@.remove.all.this.long.comment.yahoo.itwrote :
Prakhar wrote:
Hello,
I want a sequence of n random numbers whose sum is 1. ( There need not
be any uniform or any particular distribution).
Need it for my project related to probabilities.

Generate n (positive) random numbers, and divide each one of them by
their sum.

Regards,

Zeppe

Jun 12 '07 #3

P: n/a
Prakhar wrote:
Thanks.
Please don't top-post. Your replies belong following or interspersed
with properly trimmed quotes. See the majority of other posts in the
newsgroup, or the group FAQ list:
<http://www.parashift.com/c++-faq-lite/how-to-post.html>
Jun 12 '07 #4

This discussion thread is closed

Replies have been disabled for this discussion.