TITLE: Is there a simple test for uniform distributions?
QUESTION [28 upvotes]: I have a function that (more or less) is supposed to select a small number $m$ of random numbers from the range $[1,n]$ (for some $n \gg m$) and I need to test that it work. Is there an easy to implement test that will give good confidence that it is working correctly? (For reference the full on chi squared test is not simple enough.)
Edit: 

$m$ in $[5,500]$, $n$ is small enough I can use normal int/float types for most math.
I can get as many sets as I'm willing to wait for ($>100$s per second)

The reason I'm looking for something simple is that the code I'm checking isn't that complicated. If the test code is more complex than the code under test, then the potential for the test being wrong becomes a real problem.
Edit 2:
I took another look at Chi-squared and it's not as bad as I remembered... as long as I have a fixed number of buckets and a fixed significance threshold. (Or a canned CDF, and I don't think I do.)

REPLY [4 votes]: A good way to test for this is to note that the CDF for any continuous random variable transforms it to a uniform distribution, so you can transform a uniform distribution by the inverse CDF to get any distribution you like, and then compute statistics designed to test for that distribution.
For instance, in section 2.3, p. 679 of Cook, Gelman & Rubin they describe how to do this to transform a hypothetically uniform distribution to the standard normal, and then use the fact that the sum of squares of the normal follow a χ$^2$-distribution with N degrees of freedom, where N is the number of observations