lundi 21 septembre 2020

In JAVA's Random class how do I get random numbers from a certain set of digits ? For example (from between 30 to 40) [duplicate]

import java.util.Random ;

public class DiceMaking {

    public static void main(String[] args) {
        
        Random dice = new Random () ;
        int number ;
        
            for (int  NumberOfDigits= 1 ; NumberOfDigits<=5 ; NumberOfDigits++)  {
                
                number = 1+dice.nextInt(6);
                System.out.println(number + " ");
        }
    }

}



Aucun commentaire:

Enregistrer un commentaire