自动生成密码。(up者有分)

Jupiter520 2003-01-22 04:09:42
我要编一个自动生成密码的方法。要求密码是10位,其中夹杂着字母和数字。
请大家给个思路,如果有源代码就更好了!
先在这里谢谢大家的帮助了。
...全文
99 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
Jupiter520 2003-01-23
  • 打赏
  • 举报
回复
多谢各位了。
希偌 2003-01-22
  • 打赏
  • 举报
回复
数字、字母、符号组成的密码
char[] c=new char[10];
for(int i=0;i<10;i++)
c[i]=(char)((int)(Math.random()*75+48));
String password=new String(c);
System.out.println(password);
hoxisoft 2003-01-22
  • 打赏
  • 举报
回复

char[] c=new char[10];
for(int i=0;i<10;i++)
c[i]=(char)((int)(Math.random()*75+48));
String password=new String(c);
System.out.println(password);



//////////////////////////////////////

或:
java.util.Random r = new java.util.Random();
String st = "";
for (int i=0;i<8;i++){
st += Integer.toString(r.nextInt(36) ,36);
}
System.out.println(st);




http://expert.csdn.net/Expert/topic/1348/1348032.xml?temp=.611706
bluesmile979 2003-01-22
  • 打赏
  • 举报
回复
up先,随机数
xiaofenguser 2003-01-22
  • 打赏
  • 举报
回复
用随机数生成就可以,随机生成10个字母或数字,再拼在一起.
hoxisoft 2003-01-22
  • 打赏
  • 举报
回复
先UP。。。

过会在来。。。。

62,616

社区成员

发帖
与我相关
我的任务
社区描述
Java 2 Standard Edition
社区管理员
  • Java SE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧