I am looking for solution to pick number randomly from an integer array.
For example I have an array new int[]{1,2,3}, how can I pick a number randomly?
new int[]{1,2,3}
public static int getRandom(int[] array) { int rnd = new Random().nextInt(array.length); return array[rnd]; }