Implement a percentile() function to use in place of numpy's.

Should provide proper scaling support for old versions of numpy.