Illuminatiiiiii
4/27/2019 - 10:47 PM

Java lib 10 - Random

import java.util.Random;

public class Main {

    public static void main(String[] args) {

        //Used to generate random values
        Random r = new Random();
        System.out.println(r.nextInt()); //Generate random int
        System.out.println(r.nextLong());
        System.out.println(r.nextBoolean());
        //and so on

        //Put bounds on the int
        System.out.println(r.nextInt(100));

        r.ints(5).forEach(System.out::println); //Prints 5 random ints

        //Make sure there is a truly unique seed
        Random rand = new Random(System.currentTimeMillis());

    }
}