A model of the density distribution in the intergalactic medium (IGM), moti
vated by that found in numerical simulations, is used to demonstrate the ef
fect of a clumpy IGM and discrete sources on the reionization of the univer
se. In an inhomogeneous universe reionization occurs outside-in, starting i
n voids and gradually penetrating into overdense regions. Reionization shou
ld not be sudden but gradual, with a continuous rise of the photon mean fre
e path over a fair fraction of the Hubble time as the emissivity increases.
We show that a hydrogen Gunn-Peterson trough should be present at z simila
r or equal to 6 unless the emissivity increases with redshift at z > 4. How
ever, the epoch of overlap of cosmological H II regions could have occurred
at a higher redshift if sources of low luminosity reionized the IGM; the G
unn-Peterson trough at z similar to 6 would then appear because even the mo
st underdense voids have a large enough neutral fraction in ionization equi
librium to be optically thick to Ly alpha photons. Cosmological H II region
s near the epoch of overlap can produce gaps of transmitted flux only if lu
minous quasars contributed to the reionization, producing large H II region
s. Despite the clumpiness of the matter distribution, recombinations do not
increase the required emissivity of ionizing photons by a large factor dur
ing the reionization of hydrogen because the high-density gas is not ionize
d until a late time. We show that the He II reionization was most likely de
layed relative to the hydrogen reionization but was probably complete by z
similar to 3 (the redshift where observations are available). The reported
large optical depth fluctuations of He II are not necessarily due to an inc
omplete He II reionization but can arise from a combination of IGM density
fluctuations and variations in the intensity of the He II ionizing backgrou
nd due to luminous QSOs.