gen n random numbers sum to 1

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Prakhar

    gen n random numbers sum to 1

    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.

  • Zeppe

    #2
    Re: gen n random numbers sum to 1

    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

    Comment

    • Prakhar

      #3
      Re: gen n random numbers sum to 1

      Thanks.
      That really solved the game !! :)

      Prakhar.
      On Jun 12, 11:32 am, Zeppe
      <zep_p@.remove. all.this.long.c omment.yahoo.it wrote:
      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

      Comment

      • Default User

        #4
        Re: gen n random numbers sum to 1 - TPA

        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.c om/c++-faq-lite/how-to-post.html>

        Comment

        Working...