今日总结

处理了数据结构作业
import java.util.Random;

public class RandomStr {
public static String generateRandomCode() {
Random random = new Random();
StringBuilder code = new StringBuilder();
for (int i = 0; i < 6; i++) {
int randomNumber = random.nextInt(10);
code.append(randomNumber);
}
return code.toString();
}

public static void main(String[] args) {
    String randomCode = generateRandomCode();
    System.out.println("生成的验证码为:" + randomCode);
}

}

posted @ 2024-10-23 00:28  C(5,3)  阅读(1)  评论(0编辑  收藏  举报