jmeter-beanshell随机取数组一项

String[] wds = new String[] {"1280","1920","3840","666"};
String[] hgs = {"720","1080","2160","444"};

int index=(int)(Math.random()*wds.length);

String wd = wds[index];
String hg = hgs[index];

vars.put("wd",wd);
vars.put("hg",hg);

/*int[] wds = {1280,1920,3840,666};
int[] hgs = {720,1080,2160,444};

int index=(int)(Math.random()*wds.length);

int wd = wds[index];
int hg = hgs[index];
vars.putObject("wd",wd);
vars.putObject("hg",hg);*/

 

posted @ 2020-04-22 10:18  Mosicol  Views(1802)  Comments(0Edit  收藏  举报