Java random numbers

Your video will begin in 10
69 Views
Published
Java random number generator

#java #random #numbers

random.nextInt()
random.nextDouble()
random.nextBoolean()

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);

}
}
Category
Bro Code
Tags
java random number generator, java random dice roll, java random class
Be the first to comment