Been there, done that, most often at the Tuolumne Meadows trailhead permit office. Perhaps the park employee needs to show up at the scheduled opening time, take down the names of those physically present at that time, using a numbered roster, and then randomly and openly draw numbers and issue permits to those whose number get drawn, until the quota is filled.

They could use any equivalent system, such as showing up with the proverbial hat and allowing those present at the time to draw from it, so long as it eliminates any advantage for early arrival, while granting everyone who shows up by the scheduled opening time an equal chance for a permit.

One problem is hiking partners and groups. Perhaps, they could issue permits to a hiking partner if one hiker's name is drawn, provided that both hikers are actually present. Showing up with a buddy or spouse, then only drawing one permit, is a real bummer. Groups are even more problematic. Larger parties really need to make advance reservations.