Java Stream create from generator for random double values
import java.util.stream.Stream; public class Main { public static void main(String[] args) { Stream.generate(Math::random) .limit(10)//w ww .jav a 2s. co m .forEach(System.out::println); } }