jeudi 22 novembre 2018

Using Java: for the java.util.Random package, is the parameter for the limit inclusive?

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