Füllen Sie ein Array mit Zufallszahlen zwischen 1 und 100 Java
import java.util.Scanner;
import java.util.Arrays;
public class RndArray{
public static void main(String[] args){
Scanner scan = new Scanner(System.in);
int arrLength;
System.out.println("Enter your array's length");
arrLength = scan.nextInt();
int [] arr = new int [arrLength]; // between [] array's length
for(int i = 0 ; i<arrLength ; i++){
arr[i] = (int) (Math.random()*100 + 1);
}
System.out.println(Arrays.toString(arr));
}
}
Steven2003