How does the second level loop correspond to the random images in the first level loop

How does the second level loop correspond to the random images in the first level loop.

Please could you clarify your question? A routine inside concentric loops can “see” the variables from both spreadsheets (if both loops have one).