0

I need some help with random numbers in java

I'm trying to make a program that generates a number between 1 and 3 and prints rock, paper or scissors depending on the int, but I can't figure out how to generate a random number

12th Sep 2018, 4:47 AM
Twinkies
Twinkies - avatar
1 Antwort
0
you can generate random numbers in java using Random class..here you go import java.util.Random; Random rand = new Random(); int n = rand.nextInt(3) + 1 *3 is the maximum and the 1 is our minimum
12th Sep 2018, 4:52 AM
Mustufa Ansari
Mustufa Ansari - avatar