Rather than walk through our collection, we apply to each element of the collection at one time.
I still would use my 2nd way, making the collection a set of objects, each object knowing whether or not to increment it's counter when presented with a random number X. (Each object would have an upper/lower bound and test for them).
Add a method to pull out the counter out of each object afterwards and you're done.