We study statistical tests of uniformity based on the Lp-distances between the m nearest pairs of points, for n points generated uniformly over the k-dimensional unit hypercube or unit torus. The number of distinct pairs at distance no more than t, for t ⩾ 0, is a stochastic process whose initial part, after an appropriate transformation and as n → ∞, is asymptotically a Poisson process with unit rate. Convergence to this asymptotic is slow in the hypercube as soon as k exceeds 2 or 3, due to edge effects, but is reasonably fast in the torus. We look at the quality of approximation of the exact distributions of the test statistics by their asymptotic distributions, discuss computational issues, and apply the tests to random number generators. Linear congruential generators fail decisively certain variants of the tests as soon as n approaches the square root of the period length.