jeudi 29 décembre 2016

Generating specific number in a random way in Java

I would like to generate 50 integers randomly taken from 7, 15 and 35. I understand we can specify the range using

int random = (int )(Math. random() * 50 + 1) 

will generate an integer from 1-50 but how can generate only 7, 15 or 35?




Aucun commentaire:

Enregistrer un commentaire