取名器
Posted mr-quin
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了取名器相关的知识,希望对你有一定的参考价值。
共大量生成数据库测试实例使用
import java.util.Random;
public class RandomName {
StringBuffer fname;
StringBuffer boyname;
StringBuffer girlname;
StringBuffer name;
int num;
int length;
boolean sex; // true男 false女
boolean settedFname;
public RandomName(String f) {
sex = true;
settedFname = false;
length = 2;
name = new StringBuffer();
fname = new StringBuffer();
boyname = new StringBuffer();
girlname = new StringBuffer();
// 姓
if (f.equals("")) {
fname.append("赵钱孙李周吴郑王冯陈褚卫");
fname.append("蒋沈韩杨朱秦尤许何吕施张");
fname.append("孔曹严华金魏陶姜戚谢邹喻");
fname.append("柏水窦章云苏潘葛奚范彭郎");
fname.append("鲁韦昌马苗凤花方俞任袁柳");
fname.append("酆鲍史唐费廉岑薛雷贺倪汤");
fname.append("滕殷罗毕郝邬安常乐于时傅");
fname.append("皮卞齐康伍余元卜顾孟平黄");
fname.append("和穆萧尹姚邵湛汪祁毛禹狄");
fname.append("米贝明臧计伏成戴谈宋茅庞");
fname.append("熊纪舒屈项祝董梁杜阮蓝闵");
fname.append("席季麻强贾路娄危江童颜郭");
fname.append("梅盛林刁锺徐邱骆高夏蔡田");
fname.append("樊胡凌霍虞万支柯昝管卢莫");
fname.append("经房裘缪干解应宗丁宣贲邓");
fname.append("郁单杭洪包诸左石崔吉钮龚");
fname.append("程嵇邢滑裴陆荣翁荀羊於惠");
fname.append("甄麴家封芮羿储靳汲邴糜松");
fname.append("井段富巫乌焦巴弓牧隗山谷");
fname.append("车侯宓蓬全郗班仰秋仲伊宫");
fname.append("宁仇栾暴甘钭历戎祖武符刘");
fname.append("景詹束龙叶幸司韶郜黎蓟溥");
fname.append("印宿白怀蒲邰从鄂索咸籍赖");
fname.append("卓蔺屠蒙池乔阳郁胥能苍双");
fname.append("闻莘党翟谭贡劳逄姬申扶堵");
fname.append("冉宰郦雍却璩桑桂濮牛寿通");
fname.append("边扈燕冀僪浦尚农温别庄晏");
fname.append("柴瞿阎充慕连茹习宦艾鱼容");
fname.append("向古易慎戈廖庾终暨居衡步");
fname.append("都耿满弘匡国文寇广禄阙东");
fname.append("欧殳沃利蔚越夔隆师巩厍聂");
fname.append("晁勾敖融冷訾辛阚那简饶空");
fname.append("曾毋沙乜养鞠须丰巢关蒯相");
fname.append("查后荆红游竺权逮盍益桓公");
} else {
fname.append(f);
}
// 男孩名
boyname.append("伟勇军磊涛斌强鹏杰峰超波辉刚健明亮俊飞凯浩华平鑫毅林洋宇");
boyname.append("敏宁建兵旭雷锋彬龙翔阳剑东博威海巍晨炜帅岩江松文云力成琦");
boyname.append("进昊宏欣坤冰锐震楠佳忠庆杨新骏君栋青帆静荣立虎哲晖玮瑞光");
boyname.append("钢丹坚振晓祥良春晶猛星政智琪永迪冬琳胜康彪乐诚志维卫睿捷");
boyname.append("群森洪扬科奇铭航利鸣恒源聪凡颖欢昕武雄洁川清义滨皓达民跃");
boyname.append("越兴正靖曦璐挺淼泉程韬冲硕远昆瑜晔煜红权征雨野慧萌山丰珂");
boyname.append("彤悦朋钧彦然枫嘉峥寅烨铮卓畅钊金可昱爽盛路晋谦克方闯耀奎");
boyname.append("一晟勤豪安尧全琛腾队鸿玉泽凌渊蕾广顺莹英峻攀宾驰燕霖喆椒");
boyname.append("国恺潇琨轶芳吉亚梁焱侃臻嵩岳炯艳宝岗斐啸元辰萍柯羽培通天");
boyname.append("麟晗菲雪铁贺钰戈灿琼锦生原洲炎丽勋奕艺中德轩京标旺南黎禹");
boyname.append("莉蔚总益祺骥沛汉真非鹤升蒙城钦锴骁壮罡键瑶虹石展翼为灏玲");
boyname.append("放娜露赞娟倩懿劲婷策魁霄冉敬卿均治迅臣桦镇骞河希瑾鹰舟丁");
boyname.append("涵弘纲泳理福俭乾纯双屹涌根怡果田岭昭飚勃嵘熙贤申琰宽鼎滔");
boyname.append("昌璞逸贵喜昂柳韶瑛伦茂景柱岚实珏霞园学惠衡风玺赫桐寒圣陈");
boyname.append("旋礼霆月侠密堃富薇仁浪津垒齐炼瀚泓灵朝夏严意银璇鲲易行品");
boyname.append("垄靓苏澄赛思旗淳雯继友和革延能菁叶隽烽昶笑裕鲁铎昀骅高翀");
boyname.append("润熠锟望卡微拓名秋冶雁开定想舒庚蓉牧重孟澎信郁珉钟盼恩周");
boyname.append("潮季烈魏奔承玎来桥尚增婧茜前琴麒竞童舜会柏冠佩游珊融满添");
boyname.append("咏响珩杉韧梅乔同梦树杭念遥苗胤榕耿崇湘里疆旻启烁楷才仲隆");
boyname.append("媛晴章舰璟桔李影亭珺言笛弛营宪渝发逊运豹翊研登炳蕊鉴妍焰");
boyname.append("颂闻桢镭特曙盟贝千保功竹印玥夭冀阔圆湛澍争众肖祯默珍煌余");
boyname.append("准忱宸普韦舸创芸彭泰心廷其业水焕炬韵裙干唯 轲陆陶将骋战歆");
boyname.append("朔耕崴操幸向葵潜凤兰仪沙胡璋秦珑朗举列蓓纬垚歌献或见多谊");
boyname.append("迎州声婕栩男衍洵犇颢照辛有育甲禄起淮弋坦量楚熹劫勉典诺溪");
boyname.append("显毓稳甫羿端旦焘辑宣宙岑存迁万煦渤沁甜日翰淦劼庭徽豫锬铸");
boyname.append("蚵也好颉雍怀北西耘秀肠玄令蓬联斯霁朕箭坡澜馨瀛港岱宗闽励");
boyname.append("飙琥谷异嵬垣年尉习格锨桑讳丛淞领深赢宜律朴龚卉化陵庄财墨");
boyname.append("直煊欧棋孝子弢冕傲劭丞如燃铖畏崧汀弦墩溢崎容锁韩曼汽地芬");
boyname.append("上佶连郑兆纪盾相翌盈慰戟植晏任农");
// 女孩名
girlname.append("静敏燕艳丽娟莉芳萍玲娜丹洁红颖琳霞婷慧莹晶华倩英佳梅雪蕾");
girlname.append("琴璐伟云蓉青薇欣琼宁平媛虹杰婧雯茜楠洋君辉菲琦妍阳波俊鑫");
girlname.append("磊军爽兰晨冰瑶瑾岩瑛悦群玮欢瑜蕊宇明珊涛荣超琪玉怡文岚杨");
girlname.append("婕旭凤健芬芸晓萌飞露菁惠宏瑞蓓林璇珍月利勤清帆迪微斌娇影");
girlname.append("巍朋莎彬峰昕乐星新烨晖卉晴曼越靖维晔艺睿芹淼黎畅椒鹏春彦");
girlname.append("柳梦毅博妮坤翠然钰蔚曦茹凌扬凡美彤园炜捷亮雁叶苗菊勇锐雨");
girlname.append("力翔庆方琰聪潇威甜帅进琛花雅立姣馨珏秀亚珂思哲冉骊双娅胡");
girlname.append("培斐嘉莲莺佩剑娴玥真凯裙源奕靓侠枫洪姝敬希锦姗昱卓建兵冬");
girlname.append("强卫香焱容鸣硕浩纯韵玫婵巧笑俐羽舒盼涵峥雷可会航懿晗铭滢");
girlname.append("盈鸿茵灿程灵征金琨江贞路东煜圆贺一苹秋鹤珺南榕桦轶昊夏迎");
girlname.append("光智臻恒景吉银铮成松娣锋旋辰远樱糊坚苏喆沁霜霖皓刚晋田筠");
girlname.append("珠元湘嫣卿蒙京泓媚跃隽泉赛弘妹婉原环攀澜鹰音昆冲川芝娥贤");
girlname.append("昀野奇歌鸽竹璟苑诚滨萱霄嵘沙念汉岑桃骏谦安寅贝钦熙幸科如");
girlname.append("沛意果寒政柯芮鹃心海焕荔逸津渊尧天震瓤溪炎研颜赞营兴郑瑗");
girlname.append("益韶密歆易舟菡风笛龙爱民唯乔丰康渝驰葡祯郁蕴延俏恬毓腾杉");
girlname.append("岭诺峻缨永玎恋杏斯义俭漫正森丛漪昭硼蕙亭理铃咏岳桐璞非祺");
girlname.append("放炯焰葵依彩蝶筱戈苓为蔷展良想志总耘淳泽好妤妙翼羚竞品伶");
girlname.append("伊子烁鸥仙净格山忠肖麟默齐润淑轩蔓葳皎西绮沫桢童言禹涓严");
girlname.append("韬映赫翎玺霏达宜钧蜜泳纳忱熠振碧素珉情荟侃谊忆屹知旻珩秦");
girlname.append("飒赢或鹭霓韦桔荷吟仪励栋多炼嫒澄诗苇胜男艾习弦茗育曝石翊");
girlname.append("频蓝遥丁谨屏囡优顺鹂盟晏讳宾旎满游季楚俪凝劲礼曾眉盛颧衡");
girlname.append("辛融骅啸氛杭李娉萃芊朗痴耀克余响闻浪墩钥祥望朦嫚宝全芯陈");
girlname.append("洲行钊昂学栩仁咪连千冶旖姬晟肠稳霁恺桂茂台闽宪迅书勉霆革");
girlname.append("箐砚端旦蝴颂垄垚桥溢骞裕玄粼颍颉殷胤妲菱也典均缘梓旗煦赉");
girlname.append("飚灏郡玢键朝豫朔钢肪瑕勋刘前荃运嫱嵩牧来娓陶琚武雄筝恩堃");
girlname.append("单含绚淋添日殉孟尚照朵姿妃暖衍矫麒实骁信茉郦劫汀瀛猛城争");
girlname.append("芄勃喜女引获簧申韧晰禾翻醒鲲魏徽闪伦业尔熹戎桑绷冠颇白韫");
girlname.append("璜珑颢颐策虎联翀弛汇拉忻愉尤欧纬骥喻劼予翌繁珣慈豪彧允队");
girlname.append("令若洵汝娆权枚惟国滔奎尉夭闯俞鲁");
}
public void setLength(int length) {
this.length = length;
}
public void setSex(boolean sex) {
this.sex = sex;
}
public void setNum(int num) {
this.num = num;
}
public void buildName() {
long time;
time = System.currentTimeMillis();
Random rand = new Random();
for (int k = 0; k < num; k++) {
int f = rand.nextInt(fname.length());
name.append(fname.charAt(f));
for (int i = 0; i < length; i++) {
if (sex) {
f = rand.nextInt(boyname.length());
name.append(boyname.charAt(f));
} else {
f = rand.nextInt(fname.length());
name.append(girlname.charAt(f));
}
}
System.out.print(k + ". ");
System.out.println(name);
name.delete(0, name.length());
}
time = System.currentTimeMillis() - time;
System.out.println("本次生成 " + num + " 个名字,共用时 " + time + " 毫秒");
}
public static void main(String[] args) {
RandomName n = new RandomName("王");
n.setNum(100);
n.setSex(true);
n.buildName();
}
}
RandomName n = new RandomName("X");
姓XRandomName n = new RandomName("");
随机姓名setLength
设置名字长度setSex
设置性别setNum
设置取名数量buildName
生成名字
以上是关于取名器的主要内容,如果未能解决你的问题,请参考以下文章