  We use an array of high-resolution N-body simulations to determine the mass
function of dark matter haloes at redshifts 10-30. We develop a new method for
compensating for the effects of finite simulation volume that allows us to find
an approximation to the true ``global'' mass function. By simulating a wide
range of volumes at different mass resolution, we calculate the abundance of
haloes of mass 10^{5-12} Msun/h. This enables us to predict accurately the
abundance of the haloes that host the sources that reionize the universe. In
particular, we focus on the small mass haloes (>~10^{5.5-6} Msun/h) likely to
harbour population III stars where gas cools by molecular hydrogen emission,
early galaxies in which baryons cool by atomic hydrogen emission at a virial
temperature of ~10^4K (10^{7.5-8} Msun/h), and massive galaxies that may be
observable at redshift ~10. When we combine our data with simulations that
include high mass halos at low redshift, we find that the best fit to the halo
mass function depends not only on linear overdensity, as is commonly assumed in
analytic models, but also upon the slope of the linear power spectrum at the
scale of the halo mass. The Press-Schechter model gives a poor fit to the halo
mass function in the simulations at all epochs; the Sheth-Tormen model gives a
better match, but still overpredicts the abundance of rare objects at all times
by up to 50%. Finally, we consider the consequences of the recently released
WMAP 3-year cosmological parameters. These lead to much less structure at high
redshift, reducing the number of z=10 ``mini-haloes'' by more than a factor of
two and the number of z=30 galaxy hosts by more than four orders of magnitude.
Code to generate our best-fit halo mass function may be downloaded from
http://icc.dur.ac.uk/Research/PublicDownloads/genmf_readme.html
