Android examples for java.util:Random
random Value From Array
//package com.java2s; import java.util.Random; public class Main { public static int randomValueFromArray(Random random, int[] arr) { return arr[randomNumberInRange(random, 0, arr.length - 1)]; }/*from w w w .java2 s. c o m*/ public static int randomNumberInRange(Random random, int minX, int maxX) { return minX + random.nextInt(maxX - minX + 1); } }