/** * @author lautturi.com * Java example: how to create a random number in java */ import java.util.*; public class Lautturi { public static void main(String args[]) { Random rand = new Random(); // get a random Int between 0 - 9 (including 0 & 9); int randomNum = rand.nextInt(10); // [0-9) System.out.println("random integer:"+randomNum); } }