When calculating the probability of selecting an onto function, use the principle of inclusion-exclusion. First, calculate the total number of functions, then subtract the cases where the function is not onto, and finally divide by the total number of functions to find the probability.