首页 > 编程语言 >【算法思路】生成验证码

【算法思路】生成验证码

时间:2022-10-22 18:55:32浏览次数:53  
标签:String int 验证码 算法 result length 思路 datas

        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

相关文章