求代码解释
public class CouponCollector {
public static void main(String[] args) {
int N = Integer.parseInt(args[0]);
boolean[] found = new boolean[N];
int cardcnt = 0;
int valcnt = 0;
while (valcnt < N) {
int val = (int) (Math.random() * N);
cardcnt++;
if (!found[val]) valcnt++;
found[val] = true;
}
System.out.println(cardcnt);
}
}