Yeah, they're somewhat random.
In my 12 years of international business travel, I've been sent to ag about four times, with two of them happening in three trips.
Once, the CBP guy said, "ah Norway, step over there to agriculture." That, plus the other trips, were no sweat....it's actually easier and less stressful than a standard TSA setting.