package com.softeem;
class MakeCheckNumber {
/**
* @param args
*/
private String checkNumber;
public void setCheckNumber() {
String s="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
String single="";
String numString="";
int index=0;
for(int i=0;i<4;i++){
index = (int)(Math.random()*100)%62;
single = s.substring(index, index+1);
numString+=single;
}
this.checkNumber=numString;
}
public String getCheckNumber() {
return checkNumber;
}
public static void main(String[] args) {
// TODO Auto-generated method stub
MakeCheckNumber mcn = new MakeCheckNumber();
mcn.setCheckNumber();
System.out.println(mcn.getCheckNumber());
}
}
产生随机数
最新推荐文章于 2024-02-18 22:59:30 发布