random streams (original) (raw)

Joe Bowbeer joe.bowbeer at gmail.com
Thu Jan 3 14:52:21 PST 2013


I don't want this ints() to be confused with the one you want to add to generators. So I would name it intStream() or randomInts(). On Dec 31, 2012 10:41 AM, "Brian Goetz" <brian.goetz at oracle.com> wrote:

On the list of requested stream sources is 'stream of random numbers'.

Here's a one-line addition to Random: public IntStream ints() { return PrimitiveStreams.repeatedly(**this::nextInt); } Certainly the implementation is straightforward enough (modulo renaming of PrimitiveStreams and repeatedly, which are not yet nailed down.) Any objections here? Clearly we'd want to support streams of ints, longs, and doubles, so just calling it stream() is wrong; should they be called random.ints(), or random.intStream()?



More information about the lambda-libs-spec-observers mailing list