鱼C论坛

 找回密码
 立即注册
查看: 2191|回复: 2

[技术交流] 看到狗屁不通文章生成器,想起自己写过给人信息生成器

[复制链接]
发表于 2019-12-3 19:30:13 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能^_^

您需要 登录 才可以下载或查看,没有账号?立即注册

x
以前学servlet写的,给数据库写几个测试用户,留到现在,虽然结构servlet结构那时候狗屁不通,但这玩意我很jio傲,单独剪出来分享。
  1. public static String createName() {
  2.                 String[] firstName= {"赵","钱","孙","李","周","吴","郑","王","冯","陈","卫","蒋","沈","韩","杨",
  3.                                 "朱","秦","尤","许","何","吕","施","张","孔","曹","严","华","金","魏","陶","姜","谢","邹","柏","水","窦","章","云",
  4.                                 "苏","潘","葛","奚","范","彭","郎","鲁","韦","昌","马","苗","凤","花","方","俞","任","袁","柳","鲍","史","唐","费",
  5.                                 "廉","岑","薛","雷","贺","倪","汤","殷","罗","毕","郝","安","常","乐","于","时","傅","齐","康","伍","余","元","顾",
  6.                                 "孟","黄","萧","姚","汪","毛","米","成","戴","谈","宋","庞","纪","项","董","梁","杜","阮","季","贾","江","童","郭",
  7.                                 "盛","林","徐","丘","高","夏","蔡","田","樊","胡","霍","万","卢","莫","丁","邓","洪","包","程","陆","宁","武","刘",
  8.                                 "龙","叶","白","乔","谭","向","曾"};
  9.                 int firstIndex=(int)(Math.random()*firstName.length);
  10.                 String[] nextName= {"伟","芳","秀","英","娜","敏","静","丽","勇","强","磊","军","洋","艳","涛",
  11.                                 "志","智","仁","信","明","达","超","杰","兰","夏","霞","平","桂","松","海","瑞","睿","浩","博","昊","悦","妍","涵",
  12.                                 "玥","蕊","梓","宇","俊","君","泽","豪","轩","雨","欣","思","怡","彤","琪","峰","鹏","诗","德","诚","清","良","正",
  13.                                 "颖","灵","慧","维","壮","雄","山","柏","耀","兴","荣","华","旺","昌","胜","盛","安","顺","宁","和"};
  14.                 int nameLength=(int)(Math.random()*2+2);
  15.                 StringBuffer name=new StringBuffer();
  16.                 name.append(firstName[firstIndex]);
  17.                 while(name.length()<nameLength) {
  18.                         int nextIndex=(int)(Math.random()*nextName.length);
  19.                         name.append(nextName[nextIndex]);
  20.                 }
  21.                 return name.toString();
  22.         }
  23.         public static String createPassword() {
  24.                 String password="";
  25.                 for(int i=0;i<8;i++) {
  26.                         int num=(int)(Math.random()*10);
  27.                         password+=num;
  28.                 }
  29.                 return password;
  30.         }
  31.         public static int createAge() {
  32.                 int age=(int)(Math.random()*30+20);
  33.                 return age;
  34.         }
  35.         public static String createPhone() {
  36.                 String phone="";
  37.                 String[] prefix= {"138","181","139","131","130","180"};
  38.                 int preNum=(int)(Math.random()*prefix.length);
  39.                 phone+=prefix[preNum];
  40.                 for(int i=0;i<8;i++) {
  41.                         int num=(int)(Math.random()*10);
  42.                         phone+=num;
  43.                 }
  44.                 return phone;
  45.         }
  46.         public static String createEmail() {
  47.                 String email="";
  48.                 for(int i=0;i<8;i++) {
  49.                         int num=(int)(Math.random()*10);
  50.                         email+=num;
  51.                 }
  52.                 String[] suffix= {"@qq.com","@126.com"};
  53.                 int sufNum=(int)(Math.random()*suffix.length);
  54.                 email+=suffix[sufNum];
  55.                 return email;
  56.         }
复制代码

程序就自己运行吧,字符集是utf-8
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

 楼主| 发表于 2019-12-3 19:30:47 | 显示全部楼层
打错了
个人信息生成器
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2019-12-4 08:24:56 | 显示全部楼层
8错8错
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2024-4-19 06:17

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表