The paper discusses the influence of the Hartmann-(Shack) wavefront sensor geometry on the total error of modal wavefront reconstruction. A mathematical model is proposed which describes modal wavefront reconstruction based on Hartmann or Hartmann-Shack sensor in terms of linear operators. The modal covers the most general case and is not limited by the orthogonality of decomposition basis or by the method chosen for decomposition. The total reconstruction error is calculated for any given statistics of the wavefront to be measured. Based on this estimate, total reconstruction error is calculated for regular and randomised Hartmann masks. The calculations demonstrate that use of random masks with non-regular Fourier spectra for Zernike wavefront reconstruction for atmospheric turbulence allows to double the number of decomposition modes with the same total error.