The linear relation between surface roughness and work function of Mg and Al alloys was found.
The linear relation between the WF and surface roughness was consistent with the electrostatic field theory.
The WF of Mg alloy and Al alloy increased to 4.67 eV and 3.97 eV from initial 4.3 eV and 3.77 eV, respectively.