Meh. You have to write down any drug use on your application, and they will most likely ask you about that in the poly. The poly is what busts a lot of people.
It's actually ok to have used drugs in the past, you just have to be honest about it and write a letter saying something about not doing so moving forward (an acquaintance of mine had to do this... not sure what the specifics were).
Once people are have a clearance, most of the tests are decidedly not random. They can be requested for erratic behavior at work (e.g., passing out), but they are especially common for people who are formally busted somehow for illegal drug and/or alcohol abuse. Get a DUI, yeah, you're going to be "randomly" chosen for a test more often than anyone else you know.
If you look at the system holistically with regards to drug testing for folks with clearances, most people would say that the implementation is fairly reasonable. The rules seem incredibly draconian on the surface, but the actual enforcement is decidedly less so.
As I understand it practice the rules can be fairly flexible.
I have also heard they mostly stopped drug testing people as they where having difficulty finding enough competent, honest, non-drug users in technical fields. Or possibly more importantly they did not want discrete drug use to be a means of blackmailing someone.
PS: I can only recommend someone either answers all questions accurately and only those specific questions asked, or discreetly declines an investigation and looks for another line of work.
I know you can get a Secret and I have heard you can get a Top Secret depending on the agency. Though some agencies give random drug tests to people with Top Secret clearances and many contractors also have their own testing policy.
They do however ask about drug usage both on the application and when doing their investigation.
Id be surprised for TS I looked at a job at Hanslope Park which would have required DV (TS) clearance and you had to have drug tests. Didn't get a second interview was well over qualified - but one has to keep the DHSS happy or id lose my nugatory benefits.