Diffraction from stepped surfacesII. Arbitrary terrace distributions