生成强随机数

     Random rd = new SecureRandom();
        int type = rd.nextInt(3);
        int  num=0;
        if(type ==1){
            num=4;
        }else if(type ==2){
            num=5;
        }else if(type ==3){
            num=7;
        }else {
            num=6;
        }

 

 //ASCII 在65-90之间为大写,获取大写随机
(char)(rd.nextInt(25)+65)


//ASCII码表 在97-122之间为小写,获取小写随机
(char)(rd.nextInt(25)+97)

 

posted @ 2021-12-21 10:28  风中有朵云做的鱼  阅读(58)  评论(0)    收藏  举报