/**
* JAVA获得0-9的随机数
*
* @param length
* @return String
*/
public static String getRandomNumber(int length) {
Random random = new Random();
StringBuffer buffer = new StringBuffer();
for (int i = 0; i < length; i++) {
buffer.append(random.nextInt(10));
}
return buffer.toString();
}
|
|