Here you can find the source of rand(int min, int max)
Parameter | Description |
---|---|
min | The lowest number allowed |
max | The highest number allowed |
public static int rand(int min, int max)
//package com.java2s; //License from project: Open Source License public class Main { /**/*w ww.j a v a2 s . c om*/ * Generates a random number * * @param min The lowest number allowed * @param max The highest number allowed * @return Returns a random int between the specified boundaries */ public static int rand(int min, int max) { return min + (int) (Math.random() * ((max - min) + 1)); } }