Anthony Liu <[EMAIL PROTECTED]> wrote:
   ...
> As a matter of fact, given that we have to specify the
> number of states for an HMM, I would like to create a
> specified number of random floating numbers whose sum
> is 1.0.

def forAL(N):
     N_randoms = [random.random() for x in xrange(N)]
     total = sum(N_randoms)
     return [x/total for x in N_randoms]


Does this do what you want?  Of course, the resulting numbers are not
independent, but then the constraints you pose would contradict that.


Alex
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to