# Properties of the diff of a sorted uniformly generated set

I am studying a set of uniformly generated points, more concretely the distance between the points.

When the set is unsorted the histrogram shows it is normally distributed and that matches my intuition:

hist(diff(runif(100,0,100)))


However, when the set is sorted the histogram resembles an exponential distribution:

hist(diff(sort(runif(100,0,100))))


The way my intuition works this means that the most common distance between 2 consecutive endpoints is the smallest one of all the distances which seems odd to me, my intuition when looking at the problem was driving me more towards an inverse-gaussian, I understand the most common distances will be close to the bottom but I was not expecting it to be straight the smallest one.
What property of this system makes this happen?

• Your questions concerns uniform spacings. A very good source on these is Pyke (1965). The distribution of uniform spacings can be found therein. In your specific case, the density function is $f(D_{i})=100(1 - x/100)^{99}/100=(1-x/100)^{99}$. – COOLSerdash Jul 3 at 20:37