I can generate Stream<Double>
using generate
. E.g.
Stream.generate(Math::random).limit(10).forEach(System.out::println);
How to generate infinte random DoubleStream
instead of Stream<Double>
?
You can use Random#doubles to generateDoubleStream
Returns an effectively unlimited stream of pseudorandom double values, each between zero (inclusive) and one (exclusive). A pseudorandom double value is generated as if it's the result of calling the method nextDouble().
E.g.
new Random().doubles().limit(10).forEach(System.out::println);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With