Here you can find the source of random(int x)
Parameter | Description |
---|---|
x | The maximum range |
public static int random(int x)
//package com.java2s; //License from project: Open Source License public class Main { /**/*w ww. ja v a 2s .c o m*/ * Returns a random real number between 0 and x. The number is always * smaller than x. * * @param x The maximum range * @return A random real number */ public static int random(int x) { return (int) (Math.floor(Math.random() * x)); } }