vendredi 8 mars 2019

Is the API for `Random.ints(origin, bound)`, `.longs(origin, bound)`, etc., missing functionality?

It looks to me like it's impossible to include Integer.MAX_VALUE and Long.MAX_VALUE as possible random values when you create an IntStream or LongStream using bounds with the java.util.Random class.

This seems like a kind of annoying oversight. I can understand why they were trying to be consistent with the .doubles() version, but it makes any attempt to get a stream of random ints or longs that could include the max value (but not the full range of values, obviously, since there are methods that do that) a lot more complicated than it needs to be.

Am I missing something or has this been discussed elsewhere?




Aucun commentaire:

Enregistrer un commentaire