MCPcopy Create free account
hub / github.com/algorithmzuo/algorithm-journey / main

Method main

src/class006/Code01_FindNumber.java:9–24  ·  view source on GitHub ↗
(String[] args)

Source from the content-addressed store, hash-verified

7
8 // 为了验证
9 public static void main(String[] args) {
10 int N = 100;
11 int V = 1000;
12 int testTime = 500000;
13 System.out.println("测试开始");
14 for (int i = 0; i < testTime; i++) {
15 int n = (int) (Math.random() * N);
16 int[] arr = randomArray(n, V);
17 Arrays.sort(arr);
18 int num = (int) (Math.random() * V);
19 if (right(arr, num) != exist(arr, num)) {
20 System.out.println("出错了!");
21 }
22 }
23 System.out.println("测试结束");
24 }
25
26 // 为了验证
27 public static int[] randomArray(int n, int v) {

Callers

nothing calls this directly

Calls 6

randomArrayMethod · 0.95
rightMethod · 0.95
existMethod · 0.95
printlnMethod · 0.45
randomMethod · 0.45
sortMethod · 0.45

Tested by

no test coverage detected