Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

assigning an array with random numbers

 public static double[] list() {
    anArray = new double[10];
    for(int i=0;i<anArray.length;i++)
    {
        anArray[i] = randomFill();
    }
    return anArray;
}
Comment

add random numbers to 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));
    }
Comment

PREVIOUS NEXT
Code Example
Java :: java log4j example 
Java :: get string size 
Java :: easter egg 
Java :: path in spring form 
Java :: how to get length of 2d array java 
Java :: binary tree java 
Java :: implement queue using array in java 
Java :: android studio convert java to kotlin 
Java :: format specifier in java 
Java :: array in java 
Java :: CORS with Spring Boot 
Java :: java enum in switch statement 
Java :: runtime exception in java 
Java :: how to divide a double in java 
Java :: android studio tabbed activity 
Java :: super class java 
Java :: lopping rows rethinkdb 
Java :: Print the string after the specified character java 
Java :: stream reduce stringbuilder 
Java :: edit text on 2sec change andropid 
Java :: bukkit how to make a cancelable event 
Java :: intent- setaction FOR FILES 
Java :: syntax for new module creation in java 
Java :: Android number format thousands separator 
Java :: how to remove all components from layeredPane java 
Java :: 2d matrix multiplication 
Java :: java package keyword 
Java :: java stack declaration 
Java :: unlock the screen 
Java :: java singleton with synchronized 
ADD CONTENT
Topic
Content
Source link
Name
9+8 =