Java Random Number genRandomNumber(int begin, int end)

Here you can find the source of genRandomNumber(int begin, int end)

Description

gen Random Number

License

Open Source License

Declaration

public static int genRandomNumber(int begin, int end) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.util.Random;

public class Main {
    public static int genRandomNumber(int begin, int end) {
        int step = Math.abs(end - begin);
        int random = new Random(System.nanoTime()).nextInt(step);

        return Math.min(begin, end) + random;
    }//from   w ww  .  j  a va 2  s .  com
}

Related

  1. generateRandomNumberBetween(final int low, final int high)
  2. generateRandomNumericString(int maxLength)
  3. generateSaltNumber()
  4. genRandomNum(int pwd_len)
  5. genRandomNumber()
  6. genRandomNumber(int digitNumber)
  7. genRandomNumber(int minNumber, int maxNumber, int digits)
  8. genRandomNumberString(int numberCount)
  9. genRandomNumList(int num, int count)