get_rounded_constrained_array()
get_rounded_constrained_array( $bound_array, $sum)
Parameters
$bound_array | ||
$sum |
Lets you round the numeric elements of an array to integers while preserving their sum.
Usage:
Jetpack_Constrained_Array_Rounding::get_rounded_constrained_array( $bound_array ) if a specific sum doesn't need to be specified for the bound array
Jetpack_Constrained_Array_Rounding::get_rounded_constrained_array( $bound_array, $sum ) If the sum of $bound_array must equal $sum after rounding.
If $sum is less than the sum of the floor of the elements of the array, the class defaults to using the sum of the array elements.