Exact and fast calculation of the X-ray pair distribution function