A simple distribution problem Suppose that $x \sim U(0, 255)$ and and $y \sim U(0, 255)$, and that $x$ and $y$ are independent.
What is the distribution of $x - y$?
If I were to draw 1,000 samples from this distribution, how many times should I expect to see each possible value?
NB. These are all discrete random variables, in case that wasn't clear...

Update:
I've written a computer program to work out the expected count for each difference value. However, when I ask the computer to sum them all, it doesn't add up to 1,000. Clearly I've done something wrong somewhere, but I'm not sure precisely what. I'm probably just being dumb; if somebody could walk me through this slowly, it would be helpful.
The reason I'm doing this is that I want to do a chi-squared test to see if the data I'm getting actually does follow the expected distribution. Clearly this doesn't work if you calculate your expectations wrong. (!)
In addition, I think I may have over-simplified the program description. What my program actually does is obtain $x_1 \ldots x_{1000}$, and then compute $d_n = x_{n+1} - x_n$. Would that mean that the $d$ values are not statistically independent? If so, presumably a chi-squared test won't work at all. (I suppose I could throw away all the even-numbered $d_n$ so I'm left with non-overlapping pairs...)
 A: For a uniform, distribution, the distribution of the difference is a triangle centered on zero and falling to zero at +/- 2*255, the height given by requiring normalizing to 1. 
You're problem is using integers so this isn't exact. The exact value is given by the convolution of the two distributions. The distribution is just the number of possible values from both distribution whose difference is that value (and normalized to 1). 
A: Following the comments from Dilip Sarwate, I was able to get the expected outcomes to sum to 1,000.
My mistake was in assuming that I only need to count how many ways you can make (for example) 17, not the probability of each of those ways.
What I eventually came up with is
\begin{equation}
  \Pr(d = v) = \frac{256 - v}{256\times256}
\end{equation}
and therefore the expected count for $d=v$ is the above probability multiplied by the number of items in the sample.
This just leaves open the question of whether it's appropriate to use a chi-squared test on the differences of overlapping pairs in the first place...
