Tue Nov 11, 2008 11:52 pm
import java.util.*;
public class GenerateRandomNumber{
public static void main(String[] args){
Random rand = new Random();
int num = rand.nextInt(10);
System.out.println("Generated Random Number between 0 to 10 is : " + num);
int numNoRange = rand.nextInt();
System.out.println("Generated Random Number
without specifying any range is : " + numNoRange);
}
}
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com
Powered by phpBB © phpBB Group.