  The partition function for the random walk of an electrostatic field produced
by several static parallel infinite charged planes in which the charge
distribution could be either $\pm\sigma$ is obtained. We find the electrostatic
energy of the system and show that it can be analyzed through generalized Dyck
paths. The relation between the electrostatic field and generalized Dyck paths
allows us to sum over all possible electrostatic field configurations and is
used for obtaining the partition function of the system. We illustrate our
results with one example.
