dist function for simple histograms