2. why is this code necessary?:
a = a.collect { |el| el.linlin(min, max, 0, 1) };
a = (a * size); // fixed resolution for now
if you want to create an inversion of the data array (a),
it must be brought in a range that equals the range of the
values it was cretaed from [0...99] -> [.....] .
your formula returns values that do not match this range.
when would you want to invert the data array, for negative irpow values?
no, I mean invert the function:
y = f(x)
x = g(y) // the inversion function g.
in case of a data array:
[0,1,2,3,...n] -> [f(0),f(1)...f(n)]
the inversion allows to derive the index i from the result of f(i).
(using linear interpolation for noninteger values). This method
assumes accumulative probabilities:
http://www.math.niu.edu/~rusin/known-math/95/random.distr