现在的位置: 首页 > 综合 > 正文

java随机生成测试用例

2018年01月26日 ⁄ 综合 ⁄ 共 415字 ⁄ 字号 评论关闭

Random random = new Random();
  for (int j = 1; j <= 60; j++) {
   System.out.println("/n#TestCase"+j);
   System.out.print("input: [");
   for (int i = 1; i < 16; i++) {
    if (i % 4 == 0) {
     System.out.print(" ");
    } else {
     int choice = random.nextInt(2) % 2 == 0 ? 65 : 97; // 取得大写还是小写
     System.out.print((char) (choice + random.nextInt(26)));
    }
   }
   System.out.println("]"+"/noutput:4");
   for(int i=1; i <= 4;i++){
      System.out.println("[]");
   }
  }

【上篇】
【下篇】

抱歉!评论已关闭.