Here you can find the source of randomInteger(int min, int max)
Parameter | Description |
---|---|
min | The minimum range value, inclusive. |
max | The maximum range value, inclusive. |
public static int randomInteger(int min, int max)
//package com.java2s; //License from project: Open Source License import java.util.concurrent.ThreadLocalRandom; public class Main { /**/*from w w w . j a v a 2 s. c o m*/ * Generates and returns a pseudorandom integer value between {@code min} * and {@code max} (inclusive). * * @param min The minimum range value, inclusive. * @param max The maximum range value, inclusive. * @return A pseudorandom integer value between {@code min} and {@code max} * arguments(inclusive). */ public static int randomInteger(int min, int max) { return ThreadLocalRandom.current().nextInt(min, max + 1); } }