I have an array of ints which describes the absolute occurrence of unique items in a data set.
eg. a = [5, 3, 1]
means there are three unique items with a data set length of 9, perhaps x y and z, and they occur
x -> 5 times
y -> 3 times
z -> once
How can I "stretch" array a to a smaller or larger sized int array by maintaining proportions between the ints?
Since exact proportions can't be maintained, I think about rounding things up, eg an array of 3 items shrunk from a
would look like:
x -> 2 times
y -> once
z -> none (because it's the least probable to occur in the original array)