use hstats::Hstats;
use rand::SeedableRng;
use rand_distr::{Distribution, Normal};
const MEAN: T = 2.0;
const STD_DEV: T = 3.0;
const SEED: u64 = 42;
const NUM_SAMPLES: usize = 50_000_000;
const NUM_BINS: usize = 30;
const START: T = -8.0;
const END: T = 10.0;
type T = f64;
pub fn main() {
let mut hstats = Hstats::new(START, END, NUM_BINS);
let mut rng = rand::rngs::StdRng::seed_from_u64(SEED);
let normal = Normal::<T>::new(MEAN, STD_DEV).unwrap();
let random_data: Vec<T> = (0..NUM_SAMPLES).map(|_x| normal.sample(&mut rng)).collect();
random_data.iter().for_each(|v| hstats.add(*v));
println!("{}", hstats.with_precision(2));
}