There are 10 weighted elements in one array. I want to select an element at random N times, and then count the number of times every element occurs. Is there an algorithm that will give me the count of elements without needing to select N times? N may be a large number, in which case having to generate N samples is inefficient.
For example: There are 2 red balls and 8 white balls in a box. Randomly pick a ball from the box, then put it back, repeated 100 times. Count the total number of times a red ball or a white ball is picked.
I want to know if it's possible to get the counts without sampling 100 times.