Here you can find the source of getRandomNumber(int length)
public static int getRandomNumber(int length)
//package com.java2s; import java.util.Random; public class Main { public static int getRandomNumber(int length) { Random random = new Random(); return random.nextInt(length); }/*from w ww . j a v a 2 s. c o m*/ }