We would like to know how to generate 100 random 3 digit numbers.
import java.util.Random; // ww w . j a v a 2 s. com public class Main { public static void main(String[] args) { Random rand = new Random(); for (int i = 1; i <= 100; i++) { int randomNum = rand.nextInt((999 - 100) + 1) + 100; System.out.println(randomNum); } } }
The code above generates the following result.