Call nextInt() to get random integers

 
/*
 * Output: 
1092866141
-1813775291
-538087130
1207492102
19111874
1173765314
-795903398
1623201484
845754190
1812357378

 */

import java.util.Random;

public class MainClass {

  public static void main(String args[]) {

    Random generator = new Random();

    for(int i = 0; i < 10; i++)
      System.out.println(generator.nextInt());
  }
}
  
Home 
  Java Book 
    Essential Classes  

Random:
  1. Random
  2. Call nextInt() to get random integers
  3. call nextDouble() to get next random double value
  4. Call nextGaussian() to get next double value centered at 0.0 with a standard deviation of 1.0.