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

Felipe Almeida Lessa felipe.lessa at gmail.com
Sat Apr 22 00:19:13 EDT 2006


Em Sáb, 2006-04-22 às 03:16 +0000, Edward Elliott escreveu:
> If that level of accuracy 
> matters, you might consider generating your rands as integers and then 
> fp-dividing by the sum (or just store them as integers/fractions).

Or using decimal module: http://docs.python.org/lib/module-decimal.html

-- 
Felipe.




More information about the Python-list mailing list