let the histogram be an optional output.