Here you can find the source of randomInt(final int min, final int max)
min
and max
, inclusively.
Parameter | Description |
---|---|
min | Low value in range |
max | High value in range |
public static int randomInt(final int min, final int max)
//package com.java2s; /*L//from ww w . j a v a 2s .co m * Copyright RTI International * * Distributed under the OSI-approved BSD 3-Clause License. * See http://ncip.github.com/webgenome/LICENSE.txt for details. */ public class Main { /** * Generate random integer over range specified by <code>min</code> * and <code>max</code>, inclusively. * @param min Low value in range * @param max High value in range * @return A random integer */ public static int randomInt(final int min, final int max) { return min + (int) (Math.random() * (double) (max - min)); } }