Java Random Number generateRandomNumber()

Here you can find the source of generateRandomNumber()

Description

Generate a random number between 5 to 16

License

Mozilla Public License

Declaration

public static int generateRandomNumber() 

Method Source Code

//package com.java2s;
/**/*from   www  . j  a v a2  s . c o  m*/
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
 * You can obtain one at http://mozilla.org/MPL/2.0/.
 */

import java.util.Random;

public class Main {
    /**
     * Generate a random number between 5 to 16
     * 
     * @return
     */
    public static int generateRandomNumber() {
        Random randomGenerator = new Random();
        return randomGenerator.nextInt(11) + 5;
    }
}

Related

  1. createRandomNumber(int index)
  2. distinctInts(int from, int to, int number)
  3. generateRandomNum(int i)
  4. generateRandomNum(int passNumber)
  5. generateRandomNumb(int randomSize, int range)
  6. generateRandomnumber(int firstNum, int restNum)
  7. generateRandomNumber(int from, int to)
  8. generateRandomNumber(int length)
  9. generateRandomNumber(int min, int max)