thinke365 <thinke...@gmail.com> writes:

> such as uniform distribution, Normal distribution or poisson distribution.
> is there any package that can be used to generate such random numbers.

It's all in the standard library, the module is called -surprisingly-
'random'.

- use random.uniform for the uniform distributions
- use random normalvariate for normal distributions

There isn't a Poisson distribution function, but there is a expovariate
function.  I think you can get poisson like this, but take it with a
grain of salt because my probability skills are very rusty!

import random
import itertools

def poisson(l):
    e = random.expovariate
    acc = 0.0
    for n in itertools.count():
        acc += e(l)
        if acc >= 1.0:
            return n

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

Reply via email to