Choose m times out of n objects (with replacement). How many unique objects on average are chosen? You have 20 different objects in a bag and you pick 10 times, each time putting the object back in a bag. Monte-Carlo simulation (see below) shows that on average, about 8 unique objects are selected. But what's the exact answer? More generally, choose m times out of n objects (with replacement). What's the average? What's the distribution resulting?
Here is the matlab code:
% Choose m times out of n objects (with replacement).
% Output average and distribution

n=20;
m=10;
S=[];
for t=1:10000, 
    S(end+1)  = numel(unique(randi(n,m,1)));
end;
hist(S, 1:n)
mean(S)

 A: Number the objects with $1,2,\dots,20$.
For $i=1,2,\dots,20$ let $X_i$ take value $1$ if object $i$ is picked at least once and let it take value $0$ otherwise.
By linearity of expectation and symmetry we find for $X=\sum_{i=1}^{20}X_i$ (i.e. the total number of objects that are picked at least once) that:
$$\mathbb EX=20\mathbb EX_1=20P(X_1=1)=20(1-P(X_1=0))=20\left(1-\left(\frac{19}{20}\right)^{10}\right)$$

Edit on distribution:
To find the distribution of the number of objects that are picked you can apply inclusion/exclusion. If $I=\{1,\dots,20\}$ and $S=\{i\in I\mid X_i=1\}$ and e.g. we want to find $P(|S|=3)$ then at first observe that:$$P(|S|=3)=\binom{20}3P(S=\{1,2,3\})$$
Now it remains to find $P(S=\{1,2,3\})$.
Observe that: $$S=\{1,2,3\}\iff S\subseteq\{1,2,3\}\text{ and }S\text{ is not a proper subset of }\{1,2,3\}$$That implies that:$$P(S=\{1,2,3\})=P(S\subseteq\{1,2,3\})-P(S\subseteq\{1,2\}\cup S\subseteq\{1,3\}\cup S\subseteq\{2,3\})$$
Working this out with inclusion/exclusion and symmetry gives:$$P(S=\{1,2,3\})=P(S\subseteq\{1,2,3\})-3P(S\subseteq\{1,2\})+3P(S\subseteq\{1\})=$$$$\left(\frac3{20}\right)^{10}-3\times\left(\frac2{20}\right)^{10}+3\times\left(\frac1{20}\right)^{10}$$
So we end up with:$$P(|S|=3)=\binom{20}3\left(\left(\frac3{20}\right)^{10}-3\times\left(\frac2{20}\right)^{10}+3\times\left(\frac1{20}\right)^{10}\right)$$
A: Classifying by the number of objects that appear we get the following
probability for $q$ objects:
$$\frac{1}{n^m} {n\choose q} q! {m\brace q}.$$
To check that this is a probability distribution we should get one
when we add all the probabilities:
$$\frac{1}{n^m} m! [z^m]
\sum_{q=1}^n {n\choose q} (\exp(z)-1)^q.$$
We may add in $q=0$ because it does not contribute to the coefficient
extractor:
$$\frac{1}{n^m} m! [z^m] \exp(nz)
= 1.$$
The check goes through. Now for the average we get
$$\frac{1}{n^m} m! [z^m]
\sum_{q=1}^n q {n\choose q} (\exp(z)-1)^q
\\ = \frac{n}{n^m} m! [z^m]
\sum_{q=1}^n {n-1\choose q-1} (\exp(z)-1)^q
\\ = \frac{n}{n^m} m! [z^m] (\exp(z)-1)
\sum_{q=1}^n {n-1\choose q-1} (\exp(z)-1)^{q-1}
\\ = \frac{n}{n^m} m! [z^m] (\exp(z)-1) \exp((n-1)z)
\\ = \frac{n}{n^m} m! [z^m] (\exp(nz)-\exp((n-1)z))
= n\left( 1 - \frac{1}{n^m} (n-1)^m \right)
\\ = n\left( 1 - \left(1-\frac{1}{n}\right)^m \right).$$
A: This is equivalent to: Place $m$ balls in $n$ urns, with uniform probability; how many urns are occupied?
Other answers give the exact distribution (which involves Stirling numbers of the second kind).
For large $n,m$, the distribution can be approximated by $n$ iid variables with Poisson distribution, and $\lambda=m/n$
Letting $Z$ be the number of occupied urns, we have
$$P(Z=z) \approx \binom{n}{z} (1- e^{-\lambda})^z  e^{-\lambda (n-z)}$$
that is, a Binomial $(n,p)$ with $p= 1-\exp(-m/n)$
Then its expectation is (under this approximation) $n(1-\exp(-m/n))$. Which is asymptotically equivalent with the exact value $n(1- (1-1/n)^m)$
