We would like to generate 100 random number from 1 and 100.
import java.util.Random; public class Main { public static void main(String args[]) { for (int i = 0; i < 100; i++) { //your code here }// w w w .j ava2 s. c om } }
import java.util.Random; public class Main { public static void main(String args[]) { for (int i = 0; i < 100; i++) { int randomNumber = new Random().nextInt(100) + 1; System.out.println(randomNumber); } } }