Skip to content

Instantly share code, notes, and snippets.

@eagleon
Created July 28, 2012 08:05
Show Gist options
  • Save eagleon/3192374 to your computer and use it in GitHub Desktop.
Save eagleon/3192374 to your computer and use it in GitHub Desktop.
commons-lang3-3.1.jar
RandomStringUtils.random(5);//产生5位长度的随机字符串
//使用指定的字符生成5位长度的随机字符串
RandomStringUtils.random(5, new char[]{'a','b','c','d','e','f'});
//生成指定长度的字母和数字的随机组合字符串
RandomStringUtils.randomAlphanumeric(5);
//生成随机数字字符串
RandomStringUtils.randomNumeric(5);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment