您的位置:首页 > 运维架构 > Shell

BeanShell PreProcessor数组参数

spring_poll 2020-09-12 13:38 162 查看 https://blog.51cto.com/3577121

代码

import java.util.Random;

class getNUmberUtils{

public static int getRandNumber() {
Random random = new Random();
int[] num = {98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178};

int i = random.nextInt(num.length);
return num[i];
}
}

int num = getNUmberUtils.getRandNumber();
log.info("---------");
log.info(num.toString());
vars.put("productSkuId",num.toString());

//第二种
int[] nums = {98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178};
int number=num[${__Random(0,32,)}]
log.info("~~~~~~~~~~~~~")
log.info(string.valueOf(number));

结果

标签: 
相关文章推荐
章节导航