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);*/

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM