I want to be able to take a list of random numbers and split them into a known number of groups. The trick is I don't always need each group to contain a number but sometimes require particular groups to contains numbers. Also, it would be best if the numbers were not distributed symmetrically among the available groups. Repeatability of the grouping is crucial. If given the same set of numbers, they must always fall in the same groups.
I have an algorithm for splitting my list of numbers when there is never a required bucket, called modulo
, but get hung up when a bucket is required to have a number.
So, a typical example would be 10 random numbers and 4 group, 3 of which must contain at least 1 number, the last group may or may not get numbers.
I can't think of a good way of doing this. All the things I thought up either evenly divide among the groups, including the non-required one, or don't work, or kinda suck.
There has to be some math theory that lets you take a random assortment of numbers and map it to some ranges...
anyone?
I have an algorithm for splitting my list of numbers when there is never a required bucket, called modulo
So, a typical example would be 10 random numbers and 4 group, 3 of which must contain at least 1 number, the last group may or may not get numbers.
I can't think of a good way of doing this. All the things I thought up either evenly divide among the groups, including the non-required one, or don't work, or kinda suck.
There has to be some math theory that lets you take a random assortment of numbers and map it to some ranges...
anyone?
