You can create a random number I / O stream like this:
Stream<Double> randoms = Stream.generate(Math::random); Math::random will produce, as I understand it, a random number between (equal to) 0.0 and 1.0 . How can you set a range, for example, between 20 and 50?