  Galaxy clustering is a standard cosmological probe that is commonly analysed
through two-point statistics. In observations, the estimation of the two-point
correlation function crucially relies on counting pairs in a random catalogue.
The latter contains a large number of randomly distributed points, which
accounts for the survey window function. Random pair counts can also be
advantageously used for modelling the window function in the observed power
spectrum. Since pair counting scales as $\mathcal{O}(N^2)$, where $N$ is the
number of points, the computational time to measure random pair counts can be
very expensive for large surveys. In this work, we present an alternative
approach for estimating those counts that does not rely on the use of a random
catalogue. We derived an analytical expression for the anisotropic
random-random pair counts that accounts for the galaxy radial distance
distribution, survey geometry, and possible galaxy weights.
  Considering the cases of the VIPERS and SDSS-BOSS redshift surveys, we find
that the analytical calculation is in excellent agreement with the pair counts
obtained from random catalogues. The main advantage of this approach is that
the primary calculation only takes a few minutes on a single CPU and it does
not depend on the number of random points. Furthermore, it allows for an
accuracy on the monopole equivalent to what we would otherwise obtain when
using a random catalogue with about 1500 times more points than in the data at
hand. We also describe and test an approximate expression for data-random pair
counts that is less accurate than for random-random counts, but still provides
subpercent accuracy on the monopole. The presented formalism should be very
useful in accounting for the window function in next-generation surveys, which
will necessitate accurate two-point window function estimates over huge
observed cosmological volumes.
