Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void main(String[] args) {
- SecureRandom sr = new SecureRandom();
- Scanner input = new Scanner(System.in);
- System.out.print("Enter the numbers of columns: ");
- int i = input.nextInt();
- System.out.print("\nEnter the number of rows");
- int j = input.nextInt();
- int[][]a = new int[i][j];
- System.out.print("\nEnter the number of random numbers in this array: ");
- int n = input.nextInt();
- for(int x = 0; x < a.length; x++)
- for(int y = 0; y < a.length; x++)
- a [x][y] = a[sr.nextInt(n)][sr.nextInt(n)];
- readArray(a);
- }
- public static void readArray(int[][]x){
- for(int i = 0; i < x.length; i++)
- for(int j = 0; j < x.length; j++)
- System.out.println(" "+x[i][j]);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement