Java Random generate random int stream

Description

Java Random generate random int stream

import java.util.Random;

public class Main {
  public static void main(String[] args) {
    System.out.println(new Random().ints(0, 10).findFirst().getAsInt());
    System.out.println(new Random().ints(0, 10).findFirst().getAsInt());
    System.out.println(new Random().ints(0, 10).findFirst().getAsInt());
    System.out.println(new Random().ints(0, 10).findFirst().getAsInt());
    System.out.println(new Random().ints(0, 10).findFirst().getAsInt());
    System.out.println(new Random().ints(0, 10).findFirst().getAsInt());
    System.out.println(new Random().ints(0, 10).findFirst().getAsInt());
    System.out.println(new Random().ints(0, 10).findFirst().getAsInt());
    System.out.println(new Random().ints(0, 10).findFirst().getAsInt());
    System.out.println(new Random().ints(0, 10).findFirst().getAsInt());

  }//from  w w w . jav  a2s.c  om
}



PreviousNext

Related