Collisions in a sample of uniform distribution Asked at a Microsoft interview:
Assume you have a uniform distribution (can be discrete or continuous) of size X and you randomly select a sample of size Y.
1) What is the probability in terms of X and Y of a collision?
2) What is the expected number of collisions in terms of X and Y?
 A: For the chance of a collision, see this question.
Derek Jennings's answer there with your notation reads:
$$\mathbb{P}(\mbox{collision})=1 - \left( 1- \frac{1}{X} \right)\left( 1- \frac{2}{X} \right)\cdots
 \left( 1- \frac{Y-1}{X} \right),$$

To answer the second question, we should decide what counts as a collision.
For instance, if the sample is $1,2,1,1,3$ then you could say there is only one 
collision, since only one value is repeated. On the other hand, twice during the course
of the sampling we could say "Hey, I've already seen that value". Under this second interpretation, there were two collisions. 
Interpretation 1: 
To find the expected number of collisions, it is useful to introduce the identically distributed indicator random variables
$Z(i)$ for $1\leq i\leq X$ where $Z(i)=1$ if item $i$ appears more than once, and $Z(i)=0$  otherwise.
The number $N(i)$ of times that item $i$ appears is a binomial$(Y,1/X)$ random variable so  $$\mathbb{P}(Z(i)=0)=\mathbb{P}(N(i)\leq 1)=\left({X-1\over X}\right)^{Y}+Y\left({X-1\over X}\right)^{Y-1}\left({1\over X}\right),$$ 
and
$$\mathbb{E}(\mbox{number of collisions})=\sum_{i=1}^X \mathbb{E}(Z(i))
=X\mathbb{P}(Z(1)=1) =X-X\left({X-1\over X}\right)^Y -Y \left({X-1\over X}\right)^{Y-1}.$$
Interpretation 2:
With similar arguments, you can calculate 
$$\mathbb{E}(\mbox{number of collisions})=Y+X\left({X-1\over X}\right)^Y -X.$$
A: For the continuous version, the probability of a collision will be $0$.  That is, if the random variable $W$ has uniform distribution on the interval $[a, b]$, and we take a sample of size $n$, the probability of a collision is $0$. Indeed this is true for any continuous distribution.
For the discrete version, the answer is obviously different.  This is a standard first probability course problem.  You can find full information by searching under "Birthday Problem".
