Check out example codes for "how to select a random element from an array in java". It will help you in understanding the concepts better.

Code Example 1

import java.util.Random;

public class RandomStringFromArray
{    
  	public static void main(String[] args)    
    {        
      	String[] arr={"1", "2", "3", "4", "5"};
      	Random r=new Random();        
      	int randomNumber=r.nextInt(arr.length);
      	System.out.println(arr[randomNumber]);
    }
}

Learn ReactJs, React Native from akashmittal.com