For loop and a random variable

In reply to syed taahir ahmed:

For the third time, I’ll ask for the declarations of the variables involved. How does one determine how many remaining entries are left?