pub fn bincount<T>(xs: &[T], k: usize) -> Vec<usize>where T: Clone + Into<usize>,
Bins the entries in xs into k bins.
xs
k
let xs: Vec<usize> = vec![0, 0, 1, 2, 2, 2, 3]; assert_eq!(bincount(&xs, 4), vec![2, 1, 3, 1]);