Rigorous proof that a random function and a random permutation cannot be distinguished in polynomial time
A good reference is 
Code-Based Game-Playing Proofs and the Security of Triple Encryption by Bellare &amp; Rogaway. The statement that you are asking about is called the PRF/PRP switching lemma. This paper goes into significant detail about "standard" proofs of this lemma and the subtleties therein. It uses the switching lemma as an illustrative example to advocate for a "game-playing" paradigm for cryptographic proofs that is the "real" purpose of the paper.

Here is another paper (A Short Proof of the PRP/PRF Switching Lemma, Chang &amp; Nandi) that claims a short self-contained proof as well.