<s>[INST] Number of possibilities for creating words of length four A random generator is generating words of length $4$ out of the alphabet $\{0,1,2,3,4,5,6,7,8,9\}$, for example $1234$.
What is the probability to get

*

*all different numbers?

*exactly one pair of same numbers?

*exactly two pairs of the same numbers?


As to (1), my answer is
$$
\frac{10\cdot 9\cdot 8\cdot 7}{10^4}=0.504
$$
As to (2), my answer is
$$
\frac{10\cdot\binom{4}{2}\cdot 9\cdot 2\cdot 8}{10^4}=0.864
$$
Because first we have $10$ options to choose one element of the alphabet, and $\binom{4}{2}$ possibilities to choose two positions to put it. Then we have $9$ options to choose an alement different from the first one and two options to put it. Finally, we have $8$ options to choose the third element and exactly one possibility to put it down.
As to (3) my answer is
$$
\frac{10\cdot\binom{4}{2}\cdot 9}{10^4}=0.054
$$
 [/INST] The first answer is correct.  The second and third are incorrect since it does not matter which of the values is selected first when you pick two numbers that appear the same number of times.
Exactly one pair of same numbers:  There are $10$ ways to select the number which appears twice, $\binom{4}{2}$ ways to select two of the four positions for that number, $\binom{9}{2}$ ways to select the two numbers which each appear once, and $2!$ ways to arrange those numbers in the remaining two positions.  Hence, the probability that the word contains exactly one pair of numbers is
$$\frac{\dbinom{10}{1}\dbinom{4}{2}\dbinom{9}{2}2!}{10^4}$$
Exactly two pairs of the same numbers:  There are $\binom{10}{2}$ ways to select the two values which will each appear twice and $\binom{4}{2}$ ways to choose two of the four positions for the larger of those values.  Hence, the probability of obtaining two numbers which each appear twice in the string should be
$$\frac{\dbinom{10}{2}\dbinom{4}{2}}{10^4}$$
In the comments, you asked about the cases that one number appears three times and another number appears once and the case that all four numbers are the same.  Both of your proposed answers are correct.
Sanity Check:  The number $4$ can be partitioned in five ways:
\begin{align*}
4 & = 4\\
  & = 3 + 1\\
  & = 2 + 2\\
  & = 2 + 1 + 1\\
  & = 1 + 1 + 1 + 1
\end{align*}
Hence, there are five possible cases:

*

*all four numbers are the same, which you correctly found can occur in $\binom{10}{1}$ ways

*one number appears three times and another number appears once, which you correctly found can occur in $\binom{10}{1}\binom{4}{3}\binom{9}{1}$ ways

*two numbers each appear twice, which can occur in $\binom{10}{2}\binom{4}{2}$ ways

*one number appears twice and two other numbers each appear once, which can occur in $\binom{10}{1}\binom{4}{2}\binom{9}{2}2!$ ways

*four numbers each appear once, which can occur in $\binom{10}{4}4!$ ways

Notice that the sum of these probabilities is
$$\frac{\dbinom{10}{1} + \dbinom{10}{1}\dbinom{4}{3}\dbinom{9}{1} + \dbinom{10}{2}\dbinom{4}{2} + \dbinom{10}{1}\dbinom{4}{2}\dbinom{9}{2}2! + \dbinom{10}{4}4!}{10^4} = 1$$
as required.
</s>