成功捷徑,貴在堅持
          人為善,福雖未至禍已遠離; 人為惡,禍雖未至福已遠離
          <2025年6月>
          25262728293031
          1234567
          891011121314
          15161718192021
          22232425262728
          293012345

          常用鏈接

          留言簿(14)

          隨筆分類(83)

          隨筆檔案(76)

          文章分類(5)

          文章檔案(8)

          收藏夾

          最新評論

          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"
          ?};
          ?
          ?//生成密碼的位數(shù)
          ?public static int LENGTH=6;
          ?
          ?/**
          ? * @Function:<p> 生成密碼隨機數(shù)</p>
          ? * @param str? 獲取生成密碼的字符
          ? * @param len? 控制生成密碼的位數(shù)
          ? * @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;
          ?}
          }

          posted on 2006-05-09 17:35 選寶網(wǎng)an9 閱讀(393) 評論(1)  編輯  收藏 所屬分類: java

          FeedBack:
          # re: 產(chǎn)生隨機密碼
          2007-10-23 17:34 | gembin
          good  回復(fù)  更多評論
            

          只有注冊用戶登錄后才能發(fā)表評論。


          網(wǎng)站導(dǎo)航:
           
          主站蜘蛛池模板: 云浮市| 区。| 克什克腾旗| 临安市| 清丰县| 杭锦后旗| 张家港市| 青州市| 岑巩县| 阜新市| 当涂县| 黑山县| 获嘉县| 泸定县| 永顺县| 翁源县| 伊川县| 莱州市| 资兴市| 全南县| 台北县| 夏河县| 上犹县| 奈曼旗| 保山市| 苍山县| 玉门市| 孟州市| 广宗县| 宜昌市| 涞源县| 兴业县| 山丹县| 霍邱县| 元阳县| 江华| 财经| 西乌珠穆沁旗| 海丰县| 沙坪坝区| 石林|