Fill an array with random numbers

后端 未结 13 2292
感动是毒
感动是毒 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:22

    I tried to make this as simple as possible in Java. This makes an integer array of 100 variables and fill it with integers between 0 and 10 using only three lines of code. You can easily change the bounds of the random number too!

    int RandNumbers[]=new int[100];
    for (int i=0;i

提交回复
热议问题