We show how to construct a random permutation $\pi$ on $[1, n]$, given a black box that outputs numbers independently and uniformly at random from $[1, k]$ where $k \geq n$. If we compute a function $f:[1, n] \rightarrow[1, k]$ with $f(i) \neq f(j)$ for $i \neq j$, this yields a permutation; simply output the numbers $[1, n]$ according to the order of the $f(i)$ values. To construct such a function $f$, do the following for $j=1, \ldots, n:$ choose $f(j)$ by repeatedly obtaining numbers from the black box and setting $f(j)$ to the first number found such that $f(j) \neq f(i)$ for $i<j$.
Prove that this approach gives a permutation chosen uniformly at random from all permutations. Find the expected number of calls to the black box that are needed when $k=n$ and $k=2 n$. For the case $k=2 n$, argue that the probability that each call to the black box assigns a value of $f(j)$ to some $j$ is at least $1 / 2$. Based on this, use a Chernoff bound to bound the probability that the number of calls to the black box is at least $4 n$.