DoubleSummaryStatistics () { Random r = new Random(); return IntStream.range(0, 10).mapToDouble(x -> x).flatMap(x -> DoubleStream.generate(() -> r.nextDouble()*x).limit((long) x)).summaryStatistics(); }