Here you can find the source of genRandomNumber()
public static int genRandomNumber()
//package com.java2s; /******************************************************************************* * Copyright (c) 2007, 2012 Intel Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors:/*from w ww .j a va 2s . co m*/ * Intel Corporation - Initial API and implementation *******************************************************************************/ import java.util.Random; public class Main { private static Random randomNumber; public static int genRandomNumber() { if (randomNumber == null) { // Set the random number seed randomNumber = new Random(); randomNumber.setSeed(System.currentTimeMillis()); } int i = randomNumber.nextInt(); if (i < 0) { i *= -1; } return i; } }