将下面的代码,放到Beanshell中,  然后调用变量  randomName

 

import java.util.Random;

Random random=new Random();

String[] firstname=new String[]{"张","王","李","赵","刘","魏","蔡","康","肖","沈","霍","林","邓","孙"};
int i=random.nextInt(firstname.length);

String[] secondname=new String[]{"如","萍","光","城","星","贤","盛","驰","峰","旺","甜","丹","雅","祎","莉","曼","绿","君"};
int j=random.nextInt(secondname.length);

String[] lastname=new String[]{"如","萍","光","城","星","贤","盛","驰","峰","旺","甜","丹","雅","祎","莉","曼","绿","君"};
int h=random.nextInt(lastname.length);

vars.put("randomName",firstname[i]+secondname[j]+lastname[h]);

posted on 2023-03-30 15:49  小坦克  阅读(1320)  评论(0编辑  收藏  举报