It's a counter to 60, like wish credits in refine or charms. The only difference is you do not physically see the counter, and have to count it manually. Every draw counts, free or not.
If the counter hit 60, you get a rare, and counter reset to zero. If you luck out on the rng and draws a rare before counter reach 60 (something like 1% chance per scroll), the counter immediately reset to zero. This is why occasionally, you get rares in less than 60 scrolls, and future draws stop lining up in multiples of 60.
For edo treasure specifically, the rare counter is only 30 draws.