java产生随机数
java产生随机数
public String randomABC(int length) {// 随机字母Random random = new Random();String val = "";for (int i = 0; i < length; i++) {int choice = random.nextInt(2) % 2 == 0 ? 97 : 97; // 取得65大写还是97小写val += (char) (choice + random.nextInt(26));}return val;}public String random123(int length) {// 随机数字Random random = new Random();String val = "";for (int i = 0; i < length; i++) {val += random.nextInt(10) + "";}return val;}参数就是你要生成多少位的