Here you can find the source of random(int lo, int hi)
Parameter | Description |
---|---|
low | int |
up | int |
public static int random(int lo, int hi)
//package com.java2s; //License from project: Open Source License public class Main { /**/* w w w .j a v a 2 s. c om*/ * Answer a (pseudo-)random integer lo <= x < hi * Creation date: (08.10.2002 20:34:42) * @return int * @param low int * @param up int */ public static int random(int lo, int hi) { int len = hi - lo; int x = (int) (Math.random() * len); return lo + x; } }