FileDocCategorySizeDatePackage
RandomInt.javaAPI DocExample475Sat Mar 06 20:51:50 GMT 2004None

RandomInt

public class RandomInt extends Object
Generate random ints by asking Random() for a series of random integers from 1 to 10, inclusive.
author
Ian Darwin, http://www.darwinsys.com/
version
$Id: RandomInt.java,v 1.4 2004/03/07 02:51:50 ian Exp $

Fields Summary
Constructors Summary
Methods Summary
public static voidmain(java.lang.String[] a)

		Random r = new Random();
		for (int i=0; i<1000; i++)
			// nextInt(10) goes from 0-9; add 1 for 1-10;
			System.out.println(1+Math.round(r.nextInt(10)));