Here you can find the source of randInt(int min, int max)
Parameter | Description |
---|---|
min | The minimum value. |
max | The maximum value. |
public static int randInt(int min, int max)
//package com.java2s; //License from project: Open Source License public class Main { /**//from w ww . j a v a 2 s . c o m * Get a random integer within the provided range. * * @param min The minimum value. * @param max The maximum value. * @return A random integer within the provided range. */ public static int randInt(int min, int max) { return min + (int) (Math.random() * ((max - min) + 1)); } }