1 public class Solution 2 { 3 public static void main(String[] args) 4 { 5 int count = 0; 6 7 for(int i = 0; i < 100; i++) 8 { 9 System.out.print(getRandomChar(‘A‘, ‘Z‘) + " "); 10 count++; 11 if(count == 10) 12 { 13 count = 0; 14 System.out.println(); 15 } 16 } 17 18 count = 0; 19 20 for(int i = 0; i < 100; i++) 21 { 22 System.out.print(getRandomChar(‘0‘, ‘9‘) + " "); 23 count++; 24 if(count == 10) 25 { 26 count = 0; 27 System.out.println(); 28 } 29 } 30 } 31 32 public static char getRandomChar(char c1, char c2) 33 { return (char)(c1 + Math.random() * (c2 - c1 + 1)); } 34 }
时间: 2024-10-10 01:48:43