本帖最后由 zhang63 于 2014-6-3 12:01 编辑
- import java.util.Random;
- public class Test2
- {
- public static void main(String[] args)
- {
- int radnum[]=new int [100];
- Random myRandom = new Random();
-
- for(int i = 0; i < 100; i++)
- {
- radnum[i] = myRandom.nextInt(100);
- for(int j = 0; j < i; j++)
- {
- if(radnum[j] == radnum[i])
- {
- --i;
- break;
- }
- }
- }
- for (int i = 0; i < 100; i++)
- {
- if (i % 10 ==0)
- System.out.println();
- System.out.print(radnum[i] + " ");
- }
- }
- }
复制代码
|