What is probability of choose already choosen when we choose n values from set limited to m (n <= m)? I study math many years ago (I am engineer) and not remember how exactly calculate probability for such problem. I choose n values from m set and want calculate probability that all will be unique, has $1$ repeat or less, $2$ repeats or less or $k$ repeats or less.
I have set value $0 .. m$ and I do some choices from this set $n \geq 1$.
Number of choices is less or equal to set size $n \leq m$.
After every choice I return selected value from $0 .. m$ to set.
Maybe it is simple problem but I forget some theory or it is hidden deep in memory and I can not solve it easily.
Examples:

*

*if set is $m = 2$ and choice $n = 2$ probability to not choose same value is $\frac{1}{2}.$

*if set is $m = 3$ and choice $n = 2$ probability to not choose same value is  $\frac{6}{9}$ because $3*3$ permutations and $3$ combos in $2$ orders.

*if set is $m = 3$ and choices $n = 3$ $->$ $p = \frac{6}{27}$ ($3*3*3$ permutations and $3*2$ combos)

How to generalize it with probability equation?

To calculate the probability of no repeats, observe
Total ordered sequences = $m\times m\times \dots\times m = m^n $
Number of sequences with each element distinct = $\binom{m}{n} \times n!=\frac{m!}{(m-n)!} $
The probability is thus $$ \frac{m!}{m^n(m-n)!} $$
