DEV Community

Arshad Ali
Arshad Ali

Posted on

JAVA- Random Number

import java.util.Random;
public class Main {

    public static void main(String[] args) {


        Random random = new Random();

        int x = random.nextInt(6)+1;
        double y = random.nextDouble();
        boolean z = random.nextBoolean();

        System.out.println(x);
        System.out.println(y);
        System.out.println(z);
    }


}



Enter fullscreen mode Exit fullscreen mode

Top comments (0)