Random percolation as a gauge theory