Ecological communities often occur along important physical gradients such as altitude, moisture, and light. The two sample Kolmogorov-Smirnov statistic can be used to test for equality of two population abundance profiles along a gradient. Standard Monte Carlo methods demonstrate the well known fact that this procedure is highly sensitive to the presence of extra-multinomial variation-that is, local population patchiness. However, the distribution of a scaled version of the Kolmogorov-Smirnov test statistic is shown to be insensitive to large departures from the simple random sampling assumption. The procedure was developed to investigate day-night shifts in the vertical distribution of zooplankton.