the XRD pattern is in principle a Fourier transform of the pair distribution function. Thus the pair distribution function is vice versa in principle a Fourier transform of your PXRD pattern.
With respect to the related formulae please see for example page 15 of the attached file.
It's coorect what Singh told. Of course you may developa program yourself doing this job. But, it' easier to use a already developed program to calculate the pdf. A program supporting this ist PDFgetX3.
al above suggestions need to be checked for your understanding of the process.
PDFgetX3 is the best approach for this calculation in my point of view.
It is important to say that, you need specific powder x-ray diffraction to get some reasonable results. You can not do it with regular x-ray experiment, you do not have enough resolution to do so.
Usually it is necessary a very good measurement setup, area detector, high resolution wavelength tubes like Mo, Ag, synchrotron light source experiment or so. Even with higher wavelength tube, in principle it is possible, the lack of resolution will be your problem.
Before try any calculation, pay attention to your measuring conditions, fulfill the minimum necessary setup is mandatory, otherwise your results will have no useful meaning.