Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

how to add random numbers to an array

    public static void main(String[] args) {
        Random r = new Random();

        int[] xr = new int[5];
        for (int i = 0; i < xr.length; i++) {
            xr[i] = r.nextInt(101);
        }

        System.out.println(Arrays.toString(xr));
    }
 
PREVIOUS NEXT
Tagged: #add #random #numbers #array
ADD COMMENT
Topic
Name
1+5 =