Shuffling the Elements of a List or Array
Use Collections.shuffle() to randomly reorder the elements in a list.
// Create a list
List list = new ArrayList();
// Add elements to list
// Shuffle the elements in the list
Collections.shuffle(list);
// Create an array
String[] array = new String[]{"a", "b", "c"};
// Shuffle the elements in the array
Collections.shuffle(Arrays.asList(array));
very supportive
Thanks...
//I Used to shuffle an Array of integers elements
import java.util.ArrayList;
import java.util.Collections;
public class NumAleatorio {
public ArrayList Aleatorio(){
ArrayList nums = new ArrayList();
nums.add(1);
nums.add(2);
nums.add(3);
nums.add(4);
nums.add(5);
Collections.shuffle(nums);
return nums;
}
}