Fill an array with random numbers

后端 未结 13 2239
感动是毒
感动是毒 2020-12-03 11:54

I need to create an array using a constructor, add a method to print the array as a sequence and a method to fill the array with random numbers of the type double.

He

13条回答
  •  眼角桃花
    2020-12-03 12:33

    People don't see the nice cool Stream producers all over the Java libs.

    public static double[] list(){
        return new Random().ints().asDoubleStream().toArray();
    }
    

提交回复
热议问题