Java Random Number getNumber(int _nX0, int _nX1)

Here you can find the source of getNumber(int _nX0, int _nX1)

Description

get Number

License

Open Source License

Declaration

private static int getNumber(int _nX0, int _nX1) 

Method Source Code

//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;
    }
}

Related

  1. getNextRandomNumber()
  2. getNum(int length)
  3. getNumAndWord(int length)
  4. getNumber()
  5. getNumber()
  6. getNumber(int length)
  7. getNumber(int length)
  8. getNumber(int length)
  9. getNumber(int seed)