Here you can find the source of randomIntFromRange(int min, int max)
Parameter | Description |
---|---|
min | minimum number in range |
max | maximum number in range |
public static int randomIntFromRange(int min, int max)
//package com.java2s; //License from project: Open Source License public class Main { /**/*from ww w. ja v a 2 s. co m*/ * Generates random int value from the specified range of int numbers * * @param min minimum number in range * @param max maximum number in range * @return random int value from range of [min, max] */ public static int randomIntFromRange(int min, int max) { return min + (int) (Math.random() * ((max - min))); } }