Suppose you now pick a first point x from [0;N] at random, then this point splits [0;N] into two segments, [0;x] and [x;N].
If you now pick the second point, at random, it will be from the lower intervall with probability x/N and from the upper intervall with probability (N-x)/N.
In the first case, the avarage distance of the second point from the first will be , while in the second case, the average distance will be .
So, given the first point x from [0;N] the average distance of the second point is .
You now only have to integrate this, multiplied with the appropriate density function , with respect to x to get the average distance of two points randomly chosen from the interval [0;N].