生成随机姓名

public class Demo {
  @Test
  public void test01() throws UnsupportedEncodingException{
    Random r=new Random();
    for(int i=0 ;i<100;i++){
      StringBuffer name=new StringBuffer();
      for(int j=0;j<2;j++){
        Integer a=r.nextInt(39)+176;
        Integer b=r.nextInt(93)+161;
        byte[] arr={a.byteValue(),b.byteValue()};
        name=name.append(new String(arr,"GBK"));
      }
      System.out.println(name);
    }
  }
}

猜你喜欢

转载自www.cnblogs.com/li19941999/p/10522010.html