Random: nextInt() : Random « java.util « Java by API






Random: nextInt()

 
/*
 * 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());
  }
}
           
         
  








Related examples in the same category

1.new Random(int intValue)
2.Random: nextDouble
3.Random: nextGaussian()
4.Random: nextLong()
5.Vector: removeElementAt(int index)