Java tutorial
//package com.java2s; import java.util.Random; public class Main { /** The random seed */ static final long seed = System.currentTimeMillis(); /** Returns a random integer between 0 and n-1 */ public static int nextInt(int n) { Random rand = new Random(seed); return Math.abs(rand.nextInt()) % n; } }