As Bathsheba said, first ask your users.
Here is a technique that I often used in such scenarios. This method will provide the most uniform distribution with an upward bias towards the end. For example, if you call DivvyUp(101, 3) , you will get 33.66, 33.67, 33.67 . Note that the distinction is not just made up at the end. Instead, each value is calculated according to what is left, and not what it started from.
public static double[] DivvyUp(double total, uint count) { var parts = new double[count]; for (var i = 0; i < count; ++i) { var part = Math.Truncate((100d * total) / (count - i)) / 100d; parts[i] = part; total -= part; } return parts; }
Michael gunter
source share