Hi,
Can anyone give me some insights for a distribution algorithm ?
Eg.
I have 60 sweets.
There are 4 groups of people.
Group 1 has 30 people.
Group 2 has 50 people.
Group 3 has 100 people.
Group 4 has 150 people.
- all 100 sweets must be distributed
- 1 person can only has 1 sweet
- each group can has 0 or more sweet
- there is no priority between the groups as long as all sweets are distributed randomly among all the people
Can anyone advise me on the algorithm ?
i will be doing this in php.