I am trying to use a macro to randomly select X items from a pool of thousand items.
(picking 10 as example)
Macro part:
Here is what I have at the beginning of the macro to update the number of item, and then check a few conditions to make sure the random 10 items picked match my set of criteria.

If the ErrorCount is zero, output the 10 items, otherwise loop to the beginning and iterate.

However, as you can see in the screenshot below, the output is 100 items (10 items for 10 iterations)
It supposed to produce only 10 items (first iterate that fit all criteria), or an error if the desired output can't be produced in 10 iterations.

This is my configuration:

It would be challenging to create anonymized data, so it is difficult to upload a copy of my macro.
I'm hoping someone could spot my mistake right away.
Appreciate any advice to fix/improve the macro.
Thank you!