Run a random action after the loop

Hi. I am using loop to fill form from csv. Is there any way i can run another action after running 5-10 loops and then resume the loop again.

Initialise variable say Counter to 0
start loop


increment Counter by 1
if count == 5
do the action
reset counter to 0

end loop