Reputation: 131
Currently I'm looking forward to generate random values of the pareto distribution using Paretovariate() function of the random module which by default accepts just one parameter i.e for the shape of the distribution (alpha),but assumes the location parameter(Xm) as 1.
How shall the python implementation be if I wanna consider some other value of Xm?
Upvotes: 1
Views: 316
Reputation: 20130
Basically, do something like
import random
def my_paretovariate(alpha, xm = 1.0):
"""
Sample Pareto variate with arbitrary xm
"""
return xm * random.paretovariate(alpha)
Upvotes: 1