Example specific to my case: is 10 inclusive in the numbers that can be generated?
import java.util.Scanner;
import java.util.Random;
public class MathTutor {
public static void main (String[] args) {
Random r = new Random();
int randomNum1 = r.nextInt(10);
int randomNum2 = r.nextInt(10);
System.out.println("Random1 is: " + randomNum1);
System.out.println("Random2 is: " + randomNum2);
}
}
Aucun commentaire:
Enregistrer un commentaire