Java tutorial
//package com.java2s; public class Main { /** A random int from 1 to range (inclusive). */ public static int randomInt(int range) { return (1 + ((int) (Math.random() * range))); } }