/// Returns the requested number of quantiles (i.e., the least value such that index/count values
/// are smaller).
Returns the requested number of quantiles .
Returns the requested number of quantiles .
pub fn calculate_quantiles(user_times: &[f64], nbr_quantiles: usize) -> Vec<f64> {
    // Returns the largest time in each bucket
    let mut ts = user_times.to_vec();
    ts.sort_by(|a, b| a.partial_cmp(b).unwrap());
    let step = (ts.len() - 1) as f64 / nbr_quantiles as f64;
    (0..nbr_quantiles)
        .map(|bucket| ts[((bucket + 1) as f64 * step) as usize])
        .collect()
}
pub fn calculate_quantiles ( user_times : & [ f64 ] , nbr_quantiles : usize ) -> Vec < f64 > { // Returns the largest time in each bucket let mut ts = user_times . to_vec ( ) ; ts . sort_by ( | a , b | a . partial_cmp ( b ) . unwrap ( ) ) ; let step = ( ts . len ( ) - 1 ) as f64 / nbr_quantiles as f64 ; ( 0 .. nbr_quantiles ) . map ( | bucket | ts [ ( ( bucket + 1 ) as f64 * step ) as usize ] ) . collect ( ) }
Returns the requested number of quantiles (i.e., the least value such that index/count values
are smaller).
Returns the requested number of quantiles ( i . e . the least value such that index / count values are smaller ) .
user_times
&[f64]
nbr_quantiles
usize