dimanche 25 janvier 2015

random number from list based off percentage

I have a list of numbers and I need to pull from that list a random number, but I need to make sure that after pulling out a set amount of numbers from said list, that they will form to a pre-defined percentile for each set out of the output numbers.


Example in coded form:



int[] nums = {2,3,6};

int twoPer = 25;
int threePer = 45;
int sixPer = 30;


So in this example if I pulled out 100 numbers at random I would need to have 25 2's, 45 3's and 30 6's.





Aucun commentaire:

Enregistrer un commentaire