bean里面做吧~
Random rnd=new Random(System.currentTimeMillis());
pwd=""+((int)(((rnd.nextDouble()*0.9)+0.1)*1000000));
方式好多~~~
然后在执行你的功能语句~
Random rnd=new Random(System.currentTimeMillis());
pwd=""+((int)(((rnd.nextDouble()*0.9)+0.1)*1000000));
方式好多~~~
然后在执行你的功能语句~
往bean里加一些代码吧
int i = Math.random()*1000;//要几位的随机数就乘以相应的位
然后把i值存入数据库
.....//连接库语句
Statement stmt=con.createStatement();
String sql="insert into a(a_sn,pwd) value('1','"+pwd+"')";//pwd上面得到
stmt.executeUpdate(sql);
stmt.close();
con.close();
...
Random rnd=new Random(System.currentTimeMillis());
for(int i = 0; i < 100; i++)
System.out.println((int)(((rnd.nextDouble()*0.9)+0.1)*1000000));