I give my students 6 hall passes per quarter that they can use as they wish: restroom, locker, etc. If the passes are not used, they can turn them in for extra credit at the end of each quarter. I copy these on a different color of paper each quarter and pass them out on the first day of the grading period. I write each student's name in pen on the first pass on the sheet and then require that they write (also in pen) their name on the other 5. This prevents them from stealing or sharing with others. If they lose them, I do not replace them. Some years I have required students who have already used all their free passes or have lost them to leave the room, but they had to make up the time with me during lunch. It's a pretty effective way of keeping the students from abusing "emergency" restroom visits. Of course, I always make exceptions for students with sincere medical problems.