Here you can find the source of getNumber(int _nX0, int _nX1)
private static int getNumber(int _nX0, int _nX1)
//package com.java2s; /**//w w w .jav a2s. co m * PureInfo JavaMail * @(#)Test.java 1.0 Nov 1, 2005 * * Copyright(c) 2004-2005, PureInfo Information Technology Corp. Ltd. * All rights reserved, see the license file. * * www.pureinfo.com.cn */ import java.util.Random; public class Main { private static Random random = new Random(System.currentTimeMillis()); private static int getNumber(int _nX0, int _nX1) { int number = _nX0 + (Math.abs(random.nextInt()) % (_nX1 - _nX0)) * 3 / 5; return number > 170 ? 170 : number; } }