I used marijuana moderately for a while. I had only been "clean" for a few months before my aptitude test. I was completely honest about my usage. I was asked why I quit, and I said it was because joining the military was what I was positive I wanted to do and that no high could ever compare to how I knew I would feel when I finally put on that uniform. Not to mention, I never cared about marijuana, it was just something to do and it was fun.
The officer commended me for my honesty and commitment in ensuring that I no longer used or surrounded myself with people who I knew had a tendency to smoke marijuana regularly. He then informed me that he was going to put my application on hold for a couple of months to ensure that I had enough time to clear my head and be sure that this was what I wanted.
Months later at the interview a different officer told me that my past drug use affected my competitiveness. My aptitude test score was high, I did well on my interview/medical, but my high school grades/past substance use were problematic. (in the sense that, as RCDcpl said, why pick someone with a history of substance use when someone who has stayed clean their entire lives is just as readily available?) I took this as a sign that I would likely not be very high on the merit list and began doing what I could to improve my competitiveness in other areas (applying to college, looking around for volunteer work, etc). I then received a job offer. It could have been arbitrary, but regardless I accepted.
I don't have anything against marijuana users (save for the perma-fried stoners who can hardly speak a sentence without stopping to regroup their thoughts...), however any illicit substance use/abuse has no place in any institution where lives may be lost if jobs are not done 100% efficiently and properly. Stay clean, be honest, and if the time comes when you do get a job offer, do your absolute best and prove to yourself/others that past mistakes can be made up for.