Here you can find the source of getRandomIntBetween(int mi, int ma)
public static int getRandomIntBetween(int mi, int ma)
//package com.java2s; import java.util.*; public class Main { static Random rm = new Random(); public static int getRandomIntBetween(int mi, int ma) { int n = rm.nextInt(); while (n < mi || n > ma) { n = rm.nextInt();/*from ww w .jav a2s.c o m*/ } return n; } }