String datas = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; String result = ""; for (int i = 0; i < 6; i++) { int r = (int) (Math.random() * datas.length()); // int r = new Random().nextInt(datas.length()); result += datas.charAt(r); } System.out.println(result);
标签:String,int,验证码,算法,result,length,思路,datas From: https://www.cnblogs.com/blanset/p/16817023.html