Here you can find the source of rand(int max)
Parameter | Description |
---|---|
max | the maximum (exclusive) value of the number |
public static int rand(int max)
//package com.java2s; //License from project: Open Source License import java.util.Random; public class Main { private static Random randomSet = new Random(); /** Get a random integer less than a given value. * // w w w.j av a2 s. com * @param max the maximum (exclusive) value of the number * @return a pseudo randomly generated number above 0 */ public static int rand(int max) { return randomSet.nextInt(max); } }