Java tutorial
//package com.java2s; //License from project: Apache License import java.util.Random; public class Main { private static Random random = new Random(); static int nextInt(int a, int b) { return Math.min(a, b) + random.nextInt(Math.abs(a - b)); } static int nextInt(int a) { return random.nextInt(a); } }