Here you can find the source of randInt(int range)
Parameter | Description |
---|---|
range | a parameter |
public static int randInt(int range)
//package com.java2s; /******************************************************************************* * Copyright (c) 2012 pf_miles./*from w w w . j a va2s.co m*/ * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * pf_miles - initial API and implementation ******************************************************************************/ public class Main { /** * generates a random integer value from 0 to (range-1) * * @param range * @return */ public static int randInt(int range) { return (int) (Math.random() * range); } }