這類位於 org.apache.commons.lang。java
簡單說一下都有哪些方法(具體參考源碼文件):
apache
random(int count) 生成一個長度爲count的字符串,隨機內容包含所有的編碼。dom
randomAscii(int count) 生成一個長度爲count的字符串,隨機內容僅包含Ascii編碼。編碼
randomAlphabetic(int count) 生成一個長度爲count的字符串,隨機內容包含字母(含大小)的編碼。spa
randomAlphanumeric(int count) 生成一個長度爲count的字符串,隨機內容包含字母(含大小)數字(0~9)的編碼。code
randomNumeric(int count) 生成一個長度爲count的字符串,隨機內容包含數字(0~9)的編碼。utf-8
random(int count, char[] chars) 生成一個長度爲count的字符串,隨機內容包含chars。ci
random(int count, String chars) 生成一個長度爲count的字符串,隨機內容包含chars。字符串
-------------------------源碼
這裏在說明一下生成漢字的方法,參考:utf-8漢字的編碼範圍
RandomStringUtils.random(20, 0x4e00, 0x9fa5, false,false)