The number of combinations is 10^4. This is because you have 10 * 10 * 10 * 10 = 10,000. Each different digit can be chosen independent of the other digits you have.
If the numbers have to be unique, then you will have 10 * 9 * 8 * 7 = 5040 combinations. This is because for the first digit you have a choice of 10 numbers. But you effectively have a choice of 9 numbers for the second number. This is because one of them has already been used (your choice of the first digit). And again and again, giving you a choice of 8 and then 7 numbers to choose from for the remaining digits.
Now, ordering. If you have three numbers, how many ways can you write them? Take 3 numbers to make it easy:
1 2 3
1 3 2
2 1 3
2 3 1
3 1 2
3 2 1
That gives 6 combinations (any order). This can be easily understood with factorials. A factorial of a number is the result of multiplying that (integer number greater than zero) by numbers successively down to zero. It's written as an exclamation mark.
So for example, 2 factorial = 2! = 2 * 1 = 2.
Thee factorial = 3! = 3 * 2 * 1 = 6.
4 factorial = 4 * 3 * 2 = 24.
You notice here that three factorial gives 6. So to see how many choices of arrangements we have of a 3 digit number, we just find its factorial (6, as we have shown above).
Back to your problem.
For the first question, we have shown that there are 10,000 possible combinations of any 4 digit code (if each number can be from 0 to 9).
So the probability of choosing this one number is 1 / 10,000 = 0.0001.
But if you can choose this in any order, you should multiply this by 4! (4 factorial), since there are 4 numbers to rearrange in any order. This gives us a probability of 0.0024.
If the numbers are all unique (different), then there are 5040 combinations. This gives us a