Recently because to do database-related tests, frequently used to test data, manually add too much trouble, and reusability is too poor, so it took a little time to write a random name and related data of the class, posted here, the need for comrades can refer to. The quality of the code itself is not good, nor is the norm, picking mo to tease-. -
Public classGetrandomname {Private Static stringFirstName =@"Zhao, Qian, Sun, Li, Zhou, Wu, Zheng, Wang, Feng, Chen, Chu, Wei, Jiang, Shen, Han, Yang, Zhu, Qin, especially, Xu, he, Lv, Shi, Zhang, Hole, Cao, Yan, Hua, Jin, Wei, Tao, Jiang, Qi, Xie, Zou, Yu, Bai, Shui, Dou, Zhang, Yun, Su, pan, GE, Xi, van , Peng, Lang, Lu, Wei, Chang, MA, Miao, Feng, Hua, Fang, Yu, Ren, Yuan, Liu, Feng, Bao, Shi, Tang, fee, Low, CEN, Xue, Lei, he, Ni, Tang, Teng, Yin, Luo, bi, Hao, Wu, Ann, Chang, le, in, when, Fu, Pi, Bian Shenqiu, Qi, Kang, Wu, Yu, Yuan, bu , Gu, Meng, Ping, Huang, and, Mu, Shaw, Yin, Yao, Shao, Zhan, Wang, Qi, Mao, Yu, Di, MI, bei, Ming, Zang, Ji, Fu, Cheng, Dai, Talk, song, Mao, Pang, Bear, Ji, Shu, qu, Yi, Dong, Liang, Du, Ruan, blue, Min, Yi, Ji, ma, Qiang, Jia, Lu , Lou, Danger, Jiang, Tong, Yan, Guo, Mei, Sheng, Lin, Diao, Zhong, Xu, Qiu, Luo, Gao, Xia, Cai, Tian, fan, Hu, Ling, Huo, Yu, wan, zhi, ke, Zan, tube, Lou, MO, Jing, room, Jo, Barthelemy, dry, solution, should, Zong, Ding, Xuan, Ben, Deng, Yu, single, Hang, hung , bag, various, left, Stone, Cui, Kat, Knob, Gong, Cheng, Kang, Xing, slip, PEI, Lu, Rong, Weng, Xun, sheep, for, Hui, Zhen, Koji, home, seal, Rui, Yi, Chu, Jin, Ji, Bing, MI, song, Well, Duan, Fu, Wu, Wu, jiao, BA, Bow, Shepherd, Wei, Mountain, Valley, car, Hou , MI, Peng, Quan, Astrid, Ben, Yang, Qiu, Zhong, Yi, Gong, Ning, Revenge, Luan, Storm, Gan, inclined, Li, Xu, zu, Wu, Yi, Liu, king, Zhan, bundle, dragon, Leaf, Lucky, secretary, Shao, Gao, Lai, thistle, thin, Indian, homestay, white, bosom, Pu, Tai, from, E, rope, salt, nationality, Lai , Zhuo, Lin, Tu, Meng, pool, Joe, Yin, Yu, Xu, can, Cang, Shuang, Wen, Xin, party, Zhai, Tan, Gong, Lao, Feng, Ji, shen, Fu, plugging, ran, Slaughter, Li, Yong, but, Quwan, sang, Gui, Pu, Niu, Shou, Tong, Bian, Hu, Yan, Ji, Jia, Pu, Shang, Nong, Wen, don't , Zhuang, Yan, Chai, qu, yen, charge, Mu, lian, Ru, xi, Huan, AI, fish, Rong, to, ancient, easy, cautious, GE, Liao, Yu, End, Jinan, Ju, Heng, step, all, Geng, full, Hiro, Marina, country, text, Cole, Guang, Lu, Que, East, Europe, Shu, Wo, Lee, Wei, Yue, Ling, long , Division, Gong, she, Nie, Akira, Hook, AO, Rong, Leng, Zi, Xin, Kanbao, that, Jane, Rao, Empty, Zeng, no, sand, what, raise, ju, shall, abundance, nest, Guan, quine, phase, check, after, Jing, red, Tour, Aulympic, right, Lu, Gai, Yi, Huan, public, million once, Sima, Officer, Ouyang, Jaap, Zhuge, Wenren, Oriental, her, Huang Fu, shuishe, Ram, Dan Tai, Gong Ye, Munemasa, Puyang, Chun Yu, Chanyu, Shentu , Shaft, fox, clock away, Yu text, grandson, Murong, situ, Sagong"; Private Static stringLastName =@"Noah, Di, Li, Lin, Victoria, Spit, Li, New, Tao, rice, Asian, grams, Xiang, Ming, Bai, Yu, Dai, Zi, Lin, Xia, Jia, Yong, Qing, about, small, just, light, peak, spring, base, wood, country, NA, Xiao, Lan, Ah, Wei, Ying, Yuan, sound, pull, bright, ling, Wood, Hing, into , er, far, east, Wah, Asahi, Dee, Kat, Gao, Cui, Li, Yun, Hua, June, Rong, pillar, Division, health, Hao, Yao, soup, sheng, jian, Ren, learn, Rong, Yan, Cheng, Qing, Yin, chu, Jie, constitution, male, long, Pei, Xiang, Sheng, Mei, Shun, Tao, West, library, Kang, Wen, school, letter , Zhi, figure, AI, game, pan, Multi, Vibrator, Wei, ji, Fu, Ke, Lei, Tian, also, Yong, Gan, its, buy, Yao, Du, Guan, Chen, Jing, Ning, Spring, horse, Lourdes, water, dream, crystal, fine, Yao, Lang, language, day, month, star, river, drifting, Wandering, star, empty, such as, Ping, Brown, shadow , South, North"; Private Static stringNationname =@"Han, Zhuang, Manchu, Hui, Miao, Uighur, Tujia, Yi, Mongolian, Tibetan, Buyi, Dong, Yao, Korean, Bai, Hani, Kazak, Li, Dai, shes, Lisu, Gelao, Dongxiang, Gaoshan, Lahu, Aquarium, WA , Naxi, Qiang, Tu, Mulam, Kirgiz, Blang, Daur, Jingpo, Mao Nan Clan, Salar, Tajik, Chang, Pumi, Ewenki, Nu, Jing, Jino, Deang nationality, Baoan nationality, Russian, Yugur, Uzbek, Door Ba clan, Oroqen, Dulong, Tatar, Hezhe, Luo Ba clan"; StaticRandom rnd =NewRandom ((int) DATETIME.NOW.TOFILETIMEUTC ()); Public Static stringGetrandomname () {intNamelength =0; Namelength= rnd. Next (2,4); FirstName= Firstname.replace ("\ n",""); FirstName= Firstname.replace ("\ r",""); FirstName= Firstname.replace (" ",""); LastName= Lastname.replace ("\ r",""); LastName= Lastname.replace ("\ n",""); LastName= Lastname.replace (" ",""); stringName =""; string[] FirstName = Firstname.split (','); string[] LastName = Lastname.split (','); if(Namelength = =2) {Name= Firstname[rnd. Next (0, firstname.length)] + lastname[rnd. Next (0, Lastname.length)]; } Else if(Namelength = =3) {Name= Firstname[rnd. Next (0, firstname.length)] + lastname[rnd. Next (0, lastname.length)] + lastname[rnd. Next (0, Lastname.length)]; } returnname; } Public Static stringGetRandomNumber (intStartnumber,intEndnumber) { stringStrnumber =Rnd. Next (Startnumber, Endnumber). ToString (); returnStrnumber; } Public Static stringgetrandomnation () {nationname= Nationname.replace ("\ n",""); Nationname= Nationname.replace ("\ r",""); Nationname= Nationname.replace (" ",""); string[] Nationname = Nationname.split (','); stringNation = Nationname[rnd. Next (0, -)]; returnNation; } }
Where the last name of all surnames, the name is only from the following 100 words randomly take the middle of the one or two words as the name, the program can generate 2-4 characters of the name, of course, is also random, there are a lot of random people, mainly I use. It's a gift!
Some of the code in the middle is to do the format control, the elder brothers look good. Have a message or contact me directly.
C # Write a small program that generates random Chinese names