fix a bug demostrated in TestPercentilesSmallDataSet()

If the requested percentiles is larger than number of samples, then the program will panic. This bug could be fixed by checking if idx is smaller than zero.