Java獲取隨機的流水號(10位)

/**
     * 獲取隨機的流水號(10位)
     * @return
     */
     public static String getRandomReqNo() {
          int length=10;
         String base = "abcdefghijklmnopqrstuvwxyz0123456789";  
         Random random = new Random();  
         StringBuffer sb = new StringBuffer();  
         for (int i = 0; i < length; i++) {  
             int number = random.nextInt(base.length());  
             sb.append(base.charAt(number));  
         }  
         return sb.toString();  
     }   
相關文章
相關標籤/搜索