paretovariate

Casey Caseyweb at gmail.com
Mon Aug 11 13:57:51 CEST 2008


On Aug 11, 3:14 am, "zhjchen" <zhjc... at mail.ustc.edu.cn> wrote:
> I want to realize a list of numbers. They follow pareto distribution.
> For instance, the average value is 10 and alpha is 1.0
> I do not know how to use the function of paretovariate(alpha). It only provides
> alpha parameter. How should I set the average value?

I'm guessing that paretovalue(alpha) treats alpha as the shape
parameter and assumes a mode of 1.0, in which case you would multiply
by 10 for your example.

Alternatively, you could define your own Pareto function:

# pareto for mode, shape > 0.0
def pareto(mode, shape): return mode * pow(1.0 - random.random(),
-1.0 / shape)



More information about the Python-list mailing list