private static void testC(int sz) { long startTime = System.currentTimeMillis(); //开始测试时间 Random rd = new Random(); int[] rds = new int[sz];//随机数数组 List<Integer> lst = new ArrayList<Integer>();//存放有序数字集合 int index = 0;//随机索引 for (int i = 0; i < sz; i++) { lst.add(i); } for (int i = 0; i < sz; i++) { index = rd.nextInt(sz - i); rds[i] = lst.get(index); lst.remove(index); } long endTime = System.currentTimeMillis(); //获取结束时间 System.out.println("testC运行时间: " + (endTime - startTime) + "ms"); }

  

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-02
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-31
猜你喜欢
  • 2022-12-23
  • 2021-09-05
  • 2022-12-23
  • 2021-09-13
  • 2021-09-21
  • 2021-06-24
  • 2022-12-23
相关资源
相似解决方案