This code is based on the research of Kevin H. Knuth. The main purpose of this code is to find the optimal number of bins for histograms based on statistic features of data.
Parameter target is the data whose optimal number of bins are yet to be found. Parameter maxBins is the maximum number of bins of target.
Knuth. K. H., (2019). Optimal data-based binning for histograms and histogram-based probability density models. Digital Signal Processing. Vol.95. Retrieved from https://doi.org/10.1016/j.dsp.2019.102581.