Generate a sequence of random numbers that sum up to 1?

Michael Spencer mahs at telcopartners.com
Fri Apr 21 22:48:10 EDT 2006


Anthony Liu wrote:
> I am at my wit's end.
> 
> I want to generate a certain number of random numbers.
>  This is easy, I can repeatedly do uniform(0, 1) for
> example.
> 
> But, I want the random numbers just generated sum up
> to 1 . 
> 
> I am not sure how to do this.  Any idea?  Thanks.
> 
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around 
> http://mail.yahoo.com 

Divide each of your random numbers by their sum, perhaps?

Michael




More information about the Python-list mailing list