pub fn calculate_cumulative_sum_in_place<T>(mut_slice: &mut [T])
where T: Default + AddAssign<T> + Copy,
Expand description

Calculates the cumulative sum for a slice, in-place. The values are useful for example for cumulative probabilities.

So, to give an example:

use libafl_bolts::math::calculate_cumulative_sum_in_place;

let mut value = [2, 4, 1, 3];
calculate_cumulative_sum_in_place(&mut value);
assert_eq!(&[2, 6, 7, 10], &value);