@@ -0,0 +1,1876 @@
+/*%0A * Copyright 2016 Timothy Brooks%0A *%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A * http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A *%0A */%0A%0Apackage net.uncontended.precipice.pattern;%0A%0Aimport org.junit.Test;%0A%0Aimport static org.junit.Assert.assertNotEquals;%0Aimport static org.junit.Assert.assertTrue;%0A%0Apublic class ShotgunTest %7B%0A%0A    @Test%0A    public void indicesAreReturnedUniformly() %7B%0A        Shotgun shotgun = new Shotgun(3, 2);%0A%0A        int firstTotal = 0;%0A        int secondTotal = 0;%0A        int thirdTotal = 0;%0A        for (int i = 0; i %3C 5000; ++i) %7B%0A            int%5B%5D indices = shotgun.nextIndices();%0A            int first = indices%5B0%5D;%0A            int second = indices%5B1%5D;%0A            int third = indices%5B2%5D;%0A            assertNotEquals(first, second);%0A            assertNotEquals(first, third);%0A            assertNotEquals(second, third);%0A            firstTotal += first;%0A            secondTotal += second;%0A            thirdTotal += third;%0A        %7D%0A%0A        double firstMean = (double) firstTotal / 5000;%0A        double secondMean = (double) secondTotal / 5000;%0A        double thirdMean = (double) thirdTotal / 5000;%0A%0A        String message = %22Concerning distribution of indices returned%22;%0A        assertTrue(message, 0.15 %3E Math.abs(firstMean - secondMean));%0A        assertTrue(message, 0.15 %3E Math.abs(firstMean - thirdMean));%0A        assertTrue(message, 0.15 %3E Math.abs(secondMean - thirdMean));%0A    %7D%0A%7D%0A

Add shotgun test