quantile function for histogram