import java.util.Random;
/**
?*? <p>@Description:</p>
?*? <p>@Company:???? 上海###########公司</p>
?*? <p>@CreateDate:? 2006-4-19</p>
?*???? @author:????? zyk
?*??? @version:???? 1.0?
?*/
public class GenerateRandomPassword {
?
?//密碼生成字符
?public static String PASSWORDCHAR[]=new String[]{"0","1","2","3","4","5","6","7","8","9",
??"a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z",
??"A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"
?};
?
?//生成密碼的位數
?public static int LENGTH=6;
?
?/**
? * @Function:<p> 生成密碼隨機數</p>
? * @param str? 獲取生成密碼的字符
? * @param len? 控制生成密碼的位數
? * @return
? * @author zyk
? * @CREATEDATE 2006-4-19?
? */
?public static String getRandom(String str[],int len){
??String temp="";
??int rand;
??Random random = new Random();
??//random.setSeed(str.length);
??for(int i=0;i<len;i++){
???rand=random.nextInt(str.length);??????
???temp+=str[rand];
??}
??return temp;
?}
}