Suppose I have a family $X$ of vectors $X_i \in \mathbb{R}^2$, where $i\in \{1,\dots, N\}$. Let $U(a,b)$ be the continuous uniform distribution with bounds $a,b.$ They are such that $X_i=(X_{i0},X_{i1})$ where $X_{i0}$ and $X_{i1}$ are randomly chosen from $U(0,1)$. Now let's consider the matrix of all distances $D$ as such: $$D_{ij} = \sqrt{\sum_k(X_{ik} - X_{jk})^2}.$$
I would say that all $X_{ik} - X_{jk}$ can be seen as picked from $U(-1,1),$ so $D_{ij}$ should be from $U(0,\sqrt{2})$ for $i\neq j.$ The average value for non diagonal elements of $D$ should be $\sqrt{2}/2.$ And thus the average over all elements of $D$ is $$ \frac{\frac{\sqrt{2}}{2} (N^2 - N) + 0 N}{N^2} = \frac{1}{\sqrt{2}}\left(1 - \frac{1}{N}\right). $$
But when I perform the calculation numerically with $N=50'000$ I get an average value of $0.5212$ instead of the expected $0.7071..$ . Is my mistake in the algebra of uniform probability distributions?