国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > Java > 正文

java隨機字符補充版

2019-11-26 15:45:48
字體:
來源:轉載
供稿:網友
復制代碼 代碼如下:

public static void main(String[] args) {   
        //String s = RandomNum.getRandomNumStr(5);
        //System.out.println(s);
        System.out.println("生成5個含有5個字符的字符串:");
        RandomNum.SuiJiZiFuChuan(5,5);
        System.out.println("生成3個含有6個字符的字符串:");
        RandomNum.SuiJiZiFuChuan(6,3);
        System.out.println("生成任意1到20個含有任意1到10個字符的字符串:");
        RandomNum.SuiJiZiFuChuan((int)(20*Math.random()),(int)(10*Math.random()));
        System.out.println("隨機性生成字符:");
        int i=0;
        while(i<(int)(10*Math.random())){
            RandomNum.SuiJiZiFuChuan((int)(20*Math.random()),1);
            i++;
        }
    }   
    public static void SuiJiZiFuChuan(int x,int y){
        for(int j=0;j<y;j++){
            for(int i=0;i<x;i++){
                int a=(int)(100*Math.random()+100*Math.random());
                while(true){
                    if(a>96&a<123)
                        break;
                    else
                        a=(int)(100*Math.random()+100*Math.random());
                }
                System.out.print((char)a);
            }
            System.out.println();
        }
    }


執行結果:

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 化隆| 莆田市| 巫溪县| 南昌市| 小金县| 越西县| 巴林左旗| 富阳市| 化州市| 沙河市| 闸北区| 贞丰县| 石景山区| 东城区| 昭苏县| 惠来县| 博罗县| 区。| 洞口县| 本溪市| 安顺市| 调兵山市| 敦煌市| 闽侯县| 弥勒县| 绍兴县| 米脂县| 曲周县| 恭城| 新乡县| 平邑县| 梁平县| 吕梁市| 巴马| 河南省| 南投县| 平顶山市| 隆林| 吐鲁番市| 大关县| 吴旗县|