Anecdotally, I remember classmates in college using Adderall as a performance enhancing drug prior to taking exams. You could randomly drug test a subset of students and check against prescriptions, but that might get onerous.
Could you not skip those with prescriptions to the stimulants (Adderall, etc) to reduce sample space? Then your method would work well in theory. Of course, in practice, who wants to take a drug test? Certainly not before an exam! It would be chaotic