## Integration, using a parabola to generate skewed random results

ello

I'm trying to write a function that'll take a set of results, assign a probability to each result, and then pick one result at random, according to its probability.

Soooo... I thought I'd calculate the area under sections of a basic parabolic function (y = x^2) to generate the skewed probabilities.

Because of the nature of this curve, the amount of skew is determined by the range of the parabola used, as x tends to zero, the gradient tends to zero, so using 0 - 0.001 would be only slightly skewed. As x tends to infinity, the gradient tends to inifinity, so using values 0 - 100 the probabilities would be heavily skewed.

to recap then, my function would be passed a skew factor, essentially the upper limit of the parabolic graph to use. All I need do is divide the whole range into equal sections according to the number of values and determine the definite integral for each range of the parabola assigned to each of the possible values. Make sense? Good.

integrating y = x^2 gave me y = x^3 / 3

from this I developed the following code:
PHP Code:
``` vals = ["dog", "cat", "monkey", "horse", "marmotte", "hampster", "yetti", "ant", "mouse", "duck"]; skewfactor = 9; trace(getProbabilities(vals, skewfactor)); function getProbabilities(vals: Array, skewfactor: Number): Array {          var tot: Number = Math.pow(skewfactor, 3) / 3;     var range: Number = skewfactor / vals.length;          var probs: Array = new Array();     var lastbound: Number = 0;     var count: Number = 0;     while(count < vals.length) {         var ubound: Number = (count + 1) * range;         probs[count] = ((Math.pow(ubound, 3) / 3) - (Math.pow(lastbound, 3) / 3)) / tot;         lastbound = ubound;         ++count;     }          return probs; }  ```
and it kinda worked. It produced a set of probabilities which looked like they fell in line with a simple parabola.

My problem is that no matter what skew value (i.e. max range) I pass in, it produces exactly the same results and I'm not sure if my maths is wrong, my theory on the nature of the curve is wrong or if my code is wrong.

Any thoughts, comments or pointers welcomed