java random percentages
- by erw
I need to generate n percentages (integers between 0 and 100) such that the sum of all n numbers adds up to 100.
If I just do nextInt() n times, each time ensuring that the parameter is 100 minus the previously accumulated sum, then my percentages are biased (i.e. the first generated number will usually be largest etc.). How do I do this in an unbiased way?