I have two questions and it's a little more complicated than the title implies. I just spent almost 2 hours reviewing basic probability and reading lottery-related websites and I just don't have time to keep going with this on my own (I'm making a game and it's nothing to do with lotteries actually).

First let's say there's a random 4 digit number that can go from 0000 to 9999. A guesser is trying to guess the right numbers before seeing them. But it would be a "box play" in the lingo of the lottery, ie guessing the correct numbers but the numbers can appear in any order. So the guesser would win if he or she guessed 3456 and the generated number turns out to be 4365.

1)What is the probability of the guesser making a 4-digit guess but only 1 of his digits appear in the actual 4-digit generated number? What about for 2,3, or 4 of his guessed numbers turning up in the actual generated 4-digit number?

2) What if the goal of the guesser is to guess a number that is similar to the actual number. Let me explain. Let's say that the guesser guesses that the actual number is 6214. The actual number turns out to be 6114. Because there are two 1's, the guess that was made is more similar to the actual number than if the actual number was 6134. Is there a fairly easy way of calculating the probability of that level of similarity?

I think the probability for question number one is likely pretty easy to calculate, but I want to be sure I know the answer. For question number two, I think that might be complicated. Is there a formula or online tool for helping?

Thank you very much for any help you can provide.