Generating random array of fixed length (Java)

前端 未结 3 1554
南方客
南方客 2021-01-27 00:07

im just looking to change my code so that a random array of a fixed length of 100 integers is generated every time the code is ran rather than just have a pre-set array within t

3条回答
  •  Happy的楠姐
    2021-01-27 01:04

    public class Selectionsort { 
         public static void main(String[] args) {     
            int[]numbers= new int[100]
            Random random = new Random();
    
           for(int i=0;i

    The above snippet will help you to create a random numbers between 1 to 100 for the array of size 100.

提交回复
热议问题