import java.util.Random;
String random(int s_length) {
strings= "ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz";
//int s_length = 10;
rstring ="";
for (int i=0; i<s_length ; i++) {
Random randomGenerator = new Random();
int randomInt = randomGenerator.nextInt(strings.length());
rstring += strings.substring(randomInt,randomInt+1);
}
return rstring ;
}
String contents = random(20);//此处生成的是长度为20的英文
log.info("-------"+contents);
vars.put("_contents",contents);
参考: https://www.cnblogs.com/nineteen-chy/p/16111392.html
标签:字符,int,length,Beanshell,英文,随机 From: https://www.cnblogs.com/kaibindirver/p/16989128.html