From Reddit:
The problem is the "non-zero" caveat.
Any scenario described creates a non-zero chance of escape.
Unless you remove the prisoners' ability to accurately determine their statistical likelihood of escape.
No one guard, even well armed, can secure 100 prisoners.
So you take the panopticon approach, and have them police themselves.
Fire the gun into the dirt (or shoot one prisoner, depending on your morals). This showcases the weapon is real, and loaded with live ammo, not blanks.
Explain that any escape attempt will lead to you unloading the rest of your magazine into the closest prisoners to you, whether they attempt escape or not.
Then you warn you have other guards in their midst who will do the same, unloading their own hidden weapons.
You've removed their ability to accurately gauge the statistical certainty, or lack thereof, of their position.
Are you close to a guard? Is someone planning an escape? Will you be shot?
All escape attempts are undefinable, mathematically, as there are an unknown number of variables.
Everyone can escape unharmed, but no one believes they can escape unharmed.