import java.util.Random; /*********************** * Author: G. Towell * Created: August 28, 2019 * Modified: August 29, 2019 * Purpose: * Generic Methods ***********************/ public class Genere { public static void main(String[] args) { Integer[] jj = {1,2,3,4,5,6, 7, 8, 9}; // NOTE AUTOBOXING!!! Genere.randomize(jj); for (int j : jj) System.out.println(j); String[] ss = {"A", "B", "c", "d", "E", "F"}; Genere.randomize(ss); for (String s : ss) System.out.println(s); } /***** * Randomize an array, in place * @param data the array to be randomized **/ public static void randomize(T[] data) { Random r = new Random(); for (int i=0; i void swap(T[] data, int loc1, int loc2) { T temp = data[loc1]; data[loc1] = data[loc2]; data[loc2] = temp; } }