Here you can find the source of getRandomInt(String level)
public static int getRandomInt(String level)
//package com.java2s; //License from project: Apache License import java.util.Random; public class Main { public static int getRandomInt(String level) { if (level.contains("-")) { String[] spl = level.split("-"); return getRandomInt(Integer.parseInt(spl[0]), Integer.parseInt(spl[1])); } else/*from ww w.j a va 2s .c o m*/ return Integer.parseInt(level); } public static int getRandomInt(int min, int max) { Random random = new Random(); return random.nextInt((max - min) + 1) + min; } }