Not all packages get checked. There isn't enough manpower to do that. For the ost part, selection can be random.
However, packages coming from certain sources that are known to sell items prohibited in Canada (like foreign airsoft retailers) get stopped and inspected with much higher frequency than others. Same with packages addressed to recipients that have previously had such prohibited items seized.