Section 17.8 Generating Streams of Random Values

• Class SecureRandom’s methods ints (p. 762), longs and doubles (inherited from class Random) return IntStream, LongStream and DoubleStream, respectively, for streams of random numbers.

• Method ints with no arguments creates an IntStream for an infinite stream (p. 762) of random int values. An infinite stream is a stream with an unknown number of elements—you use a short-circuiting terminal operation to complete processing on an infinite stream.

• Method ints with a long argument creates an IntStream with the specified number of random int values.

• Method ints with two int arguments creates an IntStream for an infinite stream of random int values in the range starting with the first argument ...

Get Java™ How To Program (Early Objects), Tenth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.