mercredi 31 mai 2017

Why there is no nextDouble(), nextFloat() and nextLong() which accept a bound in java.util.Random

I was reading java.util.Random class and noticed that there is no nextDouble(), nextFloat() and nextLong() which can accept a bound.

There are many way to get it done like this.

But my question is why java did not provide us with these required method like nextInt(int n) which accept the bound.

Is there any specific reason they did not provide these methods?




Aucun commentaire:

Enregistrer un commentaire