new Random(int intValue) : Random « java.util « Java by API






new Random(int intValue)

 
/*
 * Output: 
First generator:
-1193959466
-1139614796
837415749
-1220615319
-1429538713
118249332
-951589224
1301674577
-1638067850
-1279751870


 */

import java.util.Random;

public class MainClass {

  public static void main(String args[]) {
    Random generator = new Random(100);

    System.out.println("First generator:");
    for(int i = 0; i < 10; i++)
      System.out.println(generator.nextInt());

  }
}


           
         
  








Related examples in the same category

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