@@ -0,0 +1,1812 @@
+//  Copyright 2016 The Minorminor Open Source Project%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%0Apackage charter3.exercises;%0A%0A%0Aimport java.util.Arrays;%0Aimport java.util.HashSet;%0Aimport java.util.Random;%0Aimport java.util.Set;%0A%0A/*%0AWrite a method, shuffle(A), that rearranges the elements of array A so that every%0Apossible ordering is equally likely. You may rely on the nextInt(n) method of%0Athe java.util.Random class, which returns a random number between 0 and n%E2%88%921%0Ainclusive.%0A */%0Apublic class C322 %7B%0A    static int%5B%5D shuffle(int%5B%5D a) %7B%0A        Random r = new Random();%0A%0A        Set%3CInteger%3E checker = new HashSet(a.length);%0A        int size = checker.size();%0A        int%5B%5D oldIndexesOrder = new int%5Ba.length%5D;%0A%0A        while (size %3C a.length) %7B%0A            int t = r.nextInt(a.length);%0A            checker.add(t);%0A            if (size != checker.size()) %7B%0A                oldIndexesOrder%5Bsize%5D = t;%0A                size = checker.size();%0A            %7D%0A        %7D%0A%0A        int%5B%5D re = new int%5Ba.length%5D;%0A        for (int i = 0; i %3C a.length; i++) %7B%0A            re%5Bi%5D = a%5BoldIndexesOrder%5Bi%5D%5D;%0A        %7D%0A        return re;%0A    %7D%0A%0A    public static void main(String%5B%5D args) %7B%0A        int%5B%5D a = new int%5B%5D%7B1, 2, 3, 4, 5, 6, 7, 8, 9, 10%7D;%0A        System.out.print(Arrays.toString(shuffle(a)));%0A    %7D%0A%7D%0A

Add C322