Let $f$ be any function $A \to B$.
By definition $f$ is a surjective function if $\space \forall y \in B \space \exists \space x \in A \space( \space f(x)=y \space)$.
So, for any function I only have to ensure that there doesn't "remain" any element "alone" in the set $B$. In other words, the range set of the function has to be equal to the codomain set.
The range depends on the function, but the codomain can be choose by me. So if I chose a codomain equal to the range I get a surjective function, regardless the function that is given.