mardi 17 novembre 2015

I generated a random number with specific limitation...is it the correct way? [duplicate]

This question already has an answer here:

//I want i which is generated randomly, to be >= 0 and <20 . Is the following code correct.?

int num= (int) (math.random());
If(num<20 && num >=0){
   System.out.println("true");
}else{
   System.out.println("false");
}




Aucun commentaire:

Enregistrer un commentaire