mercredi 21 septembre 2016

how to get next double on an open interval (x, y)

I know the basic algorithm for a range of numbers

double increment = min + (max - min) * rand.nextDouble();

This will give you a range on the interval [min, max) and that is because nextDouble includes 0 in the range. Is there a good way to exclude the minimum value from the range?




Aucun commentaire:

Enregistrer un commentaire