lundi 27 février 2017

Random int from -20 to 20 in java [duplicate]

This question already has an answer here:

How do I create a random integer ranging form -20 to 20 in java. I tried (int)(Math.random() * 20 - 20) but that only gives negatives. Thanks.




Aucun commentaire:

Enregistrer un commentaire