bounded pareto distribution

please any one can help me about the inversion method that is used to form a bounded pareto I can't understand the inversion method that is used in this function to form pareto distribution

2) Bounded Pareto pdf is (k is lower bound, p is upper bound):
- pdf is f(x) = ((a*k^a) / (1 - (k/p)^a))*x^(-a-1)

double bpareto(double a, double k, double p)
double z; // Uniform random number from 0 to 1
double pb_rv; // Computed bounded Pareto value to be returned

// Pull a uniform random number (0.0 < z < 1.0)
z = rand_val(0);
while ((z == 0.0) || (z == 1.0));

// Generate the bounded Pareto rv using the inversion method
pb_rv = -(z * pow(p,a) - z * pow(k, a) - pow(p,a)) / (pow(p, a) * pow(k,a));
pb_rv = pow(pb_rv, (-1.0 / a));



TS Contributor

Which part of the algorithm you are having trouble with? I'm not very familiar with the syntax, but I believe it is just a standard inversion algorithm. First you need to know the CDF of the bounded Pareto, and it is nice which you can directly found the inverse function (Quantile function) which will be the required functional form to transform the standard uniform. Hope you have solved this problem.