I don't want to belabor the point of how trivial it is to beat any existing method of "random" gate searches, but there are basically two current methods of selecting pax for searches, both of them flawed. I presume the following analysis is already known to the bad people.
Historically, gate searches are done on whatever passenger is next in line when a searcher becomes available, and one need only wait until the searchers are occupied with other pax. The other method currently in use is to flag BPs, in which case the selectee knows he or she is a selectee and can hand-off items to someone else before getting in line.
I can think of a couple of obvious, foolproof methods of selecting pax for gate searches, but I won't say since 1) gate-searching pax who were already screened at the checkpoint is pure security theater; and 2) TSA isn't paying me.