Is there a way to generate random double value outside a specified range?
I know there is one within the range:
Random r = new Random();
double randomValue = rangeMin + (rangeMax - rangeMin) * r.nextDouble();
I would require one that is outside the range e.g
the range is 20 - 50 and I would like a number below 20 or higher than 50.
Could someone please advise?
Aucun commentaire:
Enregistrer un commentaire