由特定姓和一组字符串随机生成一串姓名,按照习惯总字数最多4个,为什么我输出的除了两位数的名字就是数字啊
```java
import java.io.UnsupportedEncodingException;
import java.util.Random;
public class ChineseName {
public static void main(String[] args) {
Random random=new Random(System.currentTimeMillis());
String[] Surname= {"赵","钱","孙","李","周","吴","郑","王","冯","陈","褚","卫","蒋","沈","韩","杨"};
int index=random.nextInt(Surname.length-1);
String name = Surname[index]; //获得一个随机的姓氏
int a=(int)(Math.random()*3+1);
if(a==3){
name+=getChinese()+getChinese()+getChinese();
}else if(a==2){
name+=getChinese()+getChinese();
}
else {
name+=getChinese();
}
System.out.println(name);
}
public static char getChinese() {
String str = "特指汉族的语言文字即汉语和汉字在汉字文化圈和海外华人社区中中文也被称为华文汉文";
Random random = new Random();
int index = random.nextInt(str.length());
return str.charAt(index);
}
}
![img](https://img-mid.csdnimg.cn/release/static/image/mid/ask/92523222407610.png "#left")