'Accidentally'... whatever. Regardless of whether or not your aviation authority has a policy of random testing, your (future) employer probably will, as a condition of the contract. I know of a particular base of a particular airline recently being visited by company appointed testers for random checks of cabin crew and pilots - a few resigned immediately rather than take the test, a few refused and were sacked and a few took the test, tested positive and were sacked. Nobody mourned their loss as

like that have no place in aviation.
Furthermore, airport security will stop anyone who they have suspiscion may be unfit through alcohol and after testing the police and courts deal with transgressors appropriately. I see no reason why being suspected of being unfit through drugs would not be dealt with in an identical manner.
Cannabis is detectable in the hair for a very long time, and has such a long hangover effect that smoking it on your first day off will most likely still cause impairment when you are next back at work. Consider this incident to be a warning and make sure it never happens again.