Java tutorial
//package com.java2s; import java.util.Random; public class Main { /** * random in array * * @param array array which want to random * @return return a index of member in array */ public static int getRandom(int[] array) { return new Random().nextInt(array.length); } }