Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

fill array with random numbers

    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));
    }
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #fill #array #random #numbers
ADD COMMENT
Topic
Name
3+8 =