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.
numbers.append (random.uniform (0, 1.0-sum(numbers))) might help, perhaps. or scaled = [x/sum(numbers) for x in numbers] Mel. > -- http://mail.python.org/mailman/listinfo/python-list