java平台增补字符_java随机字符补充版

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

RandomNum.SuiJiZiFuChuan((int)(20*Math.random()),1);

i++;

}

}

public static void SuiJiZiFuChuan(int x,int y){

for(int j=0;j

for(int i=0;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();

}

}

执行结果:

b00676609eaf22c0b2702813de37f8cb.gif

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值