Why is the if statement failed? C++

this works fine , solved all the old issues with the loop but born a new issue, Now I have 2 random groups generated while my data table has 10 rows, so it should generate 10 groups with random items :stuck_out_tongue_closed_eyes: