Find out a huge number of coordinates is uniformly distributed or not Assume that we have a huge number of locations like $10^{6}$ locations in two-dimensional space. The coordinates are generated randomly. what I want to do is to make sure that the data distributed uniformly. the values in the locations are not important. 
The first solution is to plot them and check it visually. It is not feasible as the process of checking must be automatic. I did some research and found out that chi-squared is another possible method but the thing is that we do not have frequencies and so, in my idea it is usable in this case. Another method could be comparing distances of all locations with their neighbors but the time complexity of this method is too high and in my case, it needs $10^{12}$ comparison.
It would be really appreciated if someone help me to figure out what possible methods can be employed find out whether a bunch of coordinates is distributed uniformly or not.
 A: In general when you want to know whether some data come from a particular distribution, the Kolmogorov-Smirnov test is useful because that's exactly what it does.  But it won't work in this case because the KS test is one-dimensional.  It requires you to form a CDF of the data, and there's no natural way to do that in more dimensions because there's no unique ordering.  With that said, there are some generalizations of the test to higher dimensionality that you could try.  (This paper has four.)
As @seanv507 commented, the test (or tests) you'll want to do is going to be dependent on what features of the uniform distribution are most important for you.  Do you want to make sure that the mean is what you would expect from a uniform distribution?  The kurtosis?  That there's no correlation between the two variables?  That the maximum and minimum values in both dimensions are what you expect?  That there is roughly the same amount of data in every bin?  All of these? 
Whatever is important, test for that.  You can do the test in a non-parametric way pretty easily.  Just draw the same number of data points from a 2-D uniform distribution and calculate any of these quantities (e.g., the mean, max, min, frequencies in bins, etc.)  Do this, say, ~1000 times, and you'll get a distribution for each of these quantities.  Then see where the quantities from your data lie in all of these.  If any of them are outliers, you'll know that the data is not uniform, if they lie somewhere in the middle of these distributions, you'll know that the data are consistent with being uniform.
A: Another way to solve your problem might be to generate another sample from two-dimensional uniform distribution and then look for some kind of generalized kolmogorov - smirnov test.
Two-dimensional Kolmogorov-Smirnov - here you can find some more details (including kde.test from ks package)
