Public Function GetSJmz(ByVal 姓氏 As String, ByVal 名字 As String, ByVal 性别 As String) '3.1随机函数,随机姓名,生成姓名(单复姓、单复名,分男女)
Dim sr As String, sr1 As String, sr2 As String, sr3 As String, I As Integer, ard, arf, arB1, arB2, arG1, arG2
dxg = "王,李,张,刘,陈,杨,黄,吴,赵,周,徐,孙,马,朱,胡,林,郭,何,高,罗,郑,梁,谢,宋,唐,许,邓,冯,韩,曹,曾,彭,萧,蔡,潘,田,董,袁,于,余,叶,蒋,杜,苏,魏,程," & _
"吕,丁,沈,任,姚,卢,傅,钟,姜,崔,谭,廖,范,汪,陆,金,石,戴,贾,韦,夏,邱,方,侯,邹,熊,孟,秦,白,江,阎,薛,尹,段,雷,黎,史,龙,陶,贺,顾,毛,郝,龚,邵,万," & _
"钱,严,赖,覃,洪,武,莫,孔,汤,向,常,温,康,施,文,牛,樊,葛,邢,安,齐,易,乔,伍,庞,颜,倪,庄,聂,章,鲁,岳,翟,殷,詹,申,欧,耿,关,兰,焦,俞,左,柳,甘,祝," & _
"包,宁,尚,符,舒,阮,柯,纪,梅,童,凌,毕,单,季,裴,霍,涂,成,苗,谷,盛,曲,翁,冉,骆,蓝,路,游,辛,靳,管,柴,蒙,鲍,华,喻,祁,蒲,房,滕,屈,饶,解,牟,艾,尤," & _
"阳,时,穆,农,司,卓,古,吉,缪,简,车,项,连,芦,麦,褚,娄,窦,戚,岑,景,党,宫,费,卜,冷,晏,席,卫,米,柏,宗,瞿,桂,全,佟,应,臧,闵,苟,邬,边,卞,姬,师,和," & _
"仇,栾,隋,商,刁,沙,荣,巫,寇,桑,郎,甄,丛,仲,虞,敖,巩,明,佘,池,查,麻,苑,迟,邝,官,封,谈,匡,鞠,惠,荆,乐,冀,郁,胥,南,班,储,原,栗,燕,楚,鄢,劳,谌," & _
"奚,皮,粟,冼,蔺,楼,盘,满,闻,位,厉,伊,仝,区,郜,海,阚,花,权,强,帅,屠,豆,朴,盖,练,廉,禹,井,祖,漆,巴,丰,支,卿,国,狄,平,计,索,宣,晋,相,初,门,云," & _
"容,敬,来,扈,晁,芮,都,普,阙,浦,戈,伏,鹿,薄,邸,雍,辜,羊,阿,乌,母,裘,亓,修,邰,赫,杭,况,那,宿,鲜,印,逯,隆,茹,诸,战,慕,危,玉,银,亢,嵇,公,哈,湛," & _
"宾,戎,勾,茅,利,於,呼,居,揭,干,但,尉,冶,斯,元,束,檀,衣,信,展,阴,昝,智,幸,奉,植,衡,富,尧,闭,由,暴,贝,贲,别,邴,步,苍,昌,巢,充,从,逮,东,钭,堵," & _
"鄂,酆,凤,扶,弓,贡,广,盍,弘,红,后,滑,怀,桓,宦,汲,籍,蓟,暨,家,空,蒯,夔,历,郦,禄,糜,宓,乜,牧,能,钮,逄,蓬,濮,溥,秋,璩,却,融,山,韶,厍,慎,寿,殳," & _
"双,水,松,通,隗,蔚,沃,毋,郗,习,咸,莘,须,荀,仰,养,羿,益,鱼,庾,越,宰,终,竺,訾" '单姓一共有486个
fxg = "欧阳,太史,端木,上官,司马,东方,独孤,南宫,万俟,闻人,夏侯,诸葛,尉迟,公羊,赫连,澹台,皇甫,宗政,濮阳,公冶,太叔,申屠,公孙,慕容," & _
"仲孙,钟离,长孙,宇文,司徒,鲜于,司空,闾丘,子车,亓官,司寇,巫马,公西,颛孙,壤驷,公良,漆雕,乐正,宰父,谷梁,拓跋,夹谷,轩辕,令狐," & _
"段干,百里,呼延,东郭,南门,羊舌,微生,公户,公玉,公仪,梁丘,公仲,公上,公门,公山,公坚,左丘,公伯,西门,公祖,第五,公乘,贯丘,公皙," & _
"南荣,东里,东宫,仲长,子书,子桑,即墨,达奚,褚师,淳于,单于,徐离" '单姓一共有84个
mzB1 = "子,浩,俊,泽,博,思,海,振,宇,嘉,彦,梓,文,瑞,金,家,天,佳,清,云,立,志,宏,奕,铭,一,建,健,晨,卓,涵,哲,永,皓,润,林,昊,雨,智,景,韬,葆,保,硕,颂,琅," & _
"恒,启,睿,玉,伟,学,圣,旭,瑾,弘,苑,骏,仁,义,礼,智,信,忠,孝,利,懿,隆,发,友,梁,维,克,士,树,泰,冠,腾,崇,扬,骁,炫,炳,宗,总,祖,璜,材,瑞,传,玲,,,,,,,"
mzB2 = "泽,宇,博,铭,浩,涵,杰,轩,瑞,峰,毅,涛,然,文,睿,清,楠,源,润,明,霖,宏,洋,哲,乐,钦,林,鑫,俊,潇,天,华,阳,皓,立,翔,贤,龙,航,旭,江,渊,瑜,君,成,锋,山,奇," & _
"佑,涛,鹏,磊,辉,烨,煊,强,宸,超,骞,彬,诚,柏,熙,懿,彤,祺,豪,宸,瀚,远,驰,国,啸,果,岚,良,谦,刚,毅,军,东,健,世,广,海,波,贵,福,禄,胜,利,生,龙,祥,兴,兵," & _
"斌,彬,武,翔,飞,順,昌,星,光,达,安,民,中,茂,进,坚,邦,豪,功,松,柏,善,厚,庆,磊,裕,哲,超,政,翰,鸣,朋,棟,启,伦,旭,焱,盛,琛,骏,钧,跃,捷,赏,彰,杨,骋,熙," & _
"勋,逊,烁,烜,煜,煌,望,昶,昭,晖,晟,晔,赞,敬,翊,靖,誉,赫,颢,昱,昆,森,衡,瑱,全,锴,畅,典,鸿,能,坦,烁,帆,权,麟,帅,准,琦,榜,珅,鳌,奥,曙,裕,勤,珑,臻,,"
mzG1 = "思,佳,雪,梦,怡,雅,海,美,雨,子,钰,诗,金,嘉,涵,慧,婷,琳,若,敏,淑,凌,奕,楚,雯,清,文,梓,晨,丽,丹,佩,惠,月,玉,婉,晓,玲,倩,紫,洁,小,明,洋,婉,颖,芸,爱," & _
"德,秀,端,桦,巧,芬,彩,春,斓,兰,蘭,爱,瑞,黛,蓓,丹,纯,毓,羽,康,艺,慈,璧,碧,锦,玫,佩,锦,诺,筱,嫣,茹,紫,婧,玥,昕,鸾,黛,冰,诗,依,嫦,涟,凝,红,醉,向,慕," & _
"杏,含,歆,迎,觅,妍,倚,若,幽,寄,念,荷,潆,宜,伶,笑,逸,映,妙,尔,从,忆,书,孤,怀,惜,怜,,,,"
mzG2 = "涵,婷,慧,瑶,颖,清,月,雯,洁,岚,玲,丹,菲,媛,萍,琳,怡,玉,宁,娜,璇,云,珊,彤,佳,萱,雅,萌,欣,璐,琪,茹,梦,华,倩,君,茜,乐,如,秋,钰,静,敏,洋,宵,溪,云,媛," & _
"莹,晶,芝,心,貞,蓉,英,卿,萍,娟,巧,珠,姝,翠,娥,芳,菊,凤,凰,梅,琳,莲,环,霞,香,莺,珍,莉,桂,娣,叶,璧,璐,娅,琦,琪,妍,珊,莎,姣,娴,颖,瑶,露,怡,婵,雁,蕾," & _
"眉,媚,琴,蕊,薇,菁,苑,婕,馨,瑗,琰,聪,柔,筠,澜,悦,爽,滢,馥,凝,潇,霄,姬,影,妙,淼,婕,荣,萱,姣,娓,娉,禧,珂,琼,璇,晴,嫚,盈,袅,瑛,婧,靓,媄,昕,夏,仪,琴," & _
"园,缘,萃,菲,莎,姿,湘,涵,汝,蔚,沁,蜜,然,茵,妹,馨,娣,姬,曦,韵,漪,绮,竹,枫,双,蝶,卉,菱,桃,蕊,芙,芍,霜,虹,琰,融,纨,蕾,霏,俐,润,烟,,,,"
srzh = "一,丞,恭,畅,丹,周,京,衷,雍,嬴,冠,诚,谊,谦,谨,博,贞,修,俊,儒,阳,陶,勤,洁,润,淳,清,淑,温,忻,怡,悦,愔,慕,慷,安,宏,容,庆,康,逊,道,寿,尊,挺,捷" & _
"圣,坚,幸,培,壮,吉,志,哲,嘉,馨,懿,艺,芳,茂,英,荣,荟,莹,菁,著,萱,葩,蔼,薰,奖,尚,辉,赏,耀,名,君,知,和,善,屹,峰,崇,衍,得,德,彬,彰,扬,备,饶,孔" & _
"孜,妍,妩,妙,姣,威,姝,佳,娇,娴,娟,娥,娓,婉,婷,媛,骁,骄,骋,杰,煦,熙,炫,炳,炯,烁,烜,烨,煜,煌,忠,恩,惠,慈,慧,礼,祖,祝,祥,祺,禄,福,玉,珂,珍,珊" & _
"珠,望,琅,琼,琛,琳,瑞,瑜,瑰,璇,璜,璧,韬,本,材,盛,旭,旸,昉,景,晴,智,明,昶,昭,晏,晖,晟,晔,暄,曜,曦,曼,永,腾,贤,贺,贵,赐,赞,敏,敬,胜,朗,欢,欣" & _
"毅,翊,靖,碧,睦,睿,盈,钦,铭,锐,锦,颖,穆,馥,皓,浩,袅,褒,葆,保,美,颂,颀,硕,颐,良,誉,赫,辰,雅,韵,瑛,斌,秉,昞,宸,锋,赋,颢,豪,昊,瑾,婧,竫,珺,丽" & _
"靓,璘,璐,玫,媄,乾,茜,姗,舒,旺,玮,悟,禧,献,翔,昕,信,歆,瑶,尧,御,勇,庸,裕,钰,昱,朝,振,朕,箴,禛,佑,弘,竹,文,鑫"
ard = Split(dxg, ",")
arf = Split(fxg, ",")
arB1 = Split(mzB1, ",")
arB2 = Split(mzB2, ",")
arG1 = Split(mzG1, ",")
arG2 = Split(mzG2, ",")
Randomize
srd = Split(dxg, ",")(Int(Rnd * UBound(Split(dxg, ","))))
srf = Split(fxg, ",")(Int(Rnd * UBound(Split(fxg, ","))))
srB1 = Split(mzB1, ",")(Int(Rnd * UBound(Split(mzB1, ","))))
srB2 = Split(mzB2, ",")(Int(Rnd * UBound(Split(mzB2, ","))))
srG1 = Split(mzG1, ",")(Int(Rnd * UBound(Split(mzG1, ","))))
srG2 = Split(mzG2, ",")(Int(Rnd * UBound(Split(mzG2, ","))))
Select Case 姓氏
Case "dx"
sr1 = srd
Case "fx"
sr1 = srf
Case Else
sr1 = 姓氏
End Select
Select Case 名字
Case "dm"
Select Case 性别
Case "bx": sr2 = srB2
Case "gx": sr2 = srG2
Case Else: sr2 = Split(srzh, ",")(Int(Rnd * UBound(Split(srzh, ","))))
End Select
Case "fm"
Select Case 性别
Case "bx": sr2 = srB1 & srB2
Case "gx": sr2 = srB1 & srG2
Case Else
For I = 1 To 2
sr = sr & Split(srzh, ",")(Int(Rnd * UBound(Split(srzh, ","))))
Next
sr2 = sr
End Select
End Select
GetSJmz = sr1 & sr2
End Function
Function GetSJsz(ByVal qs As Single, ByVal js As Single, ByVal ws As Byte) '3.2随机数字(指定上限和下限)
With Application.WorksheetFunction
Randomize
GetSJsz = .Round(Rnd * (js - qs) + qs, ws)
End With
End Function
Function GetSJzf(ByVal tr As String, ByVal k As Byte) '3.3随机字符(指定位数)
srr6 = ""
For I = 1 To 26
Randomize
srr = Chr((Int(16 + Rnd() * 38 + 160) * 256) + Int(94 * Rnd()) + 160)
srr1 = srr1 & srr
Next
srr2 = "0123456789"
srr3 = "abcdefghijklmnopqrstuvwxyz"
srr4 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
srr5 = srr5 & IIf(InStr(tr, "H") > 0, srr1, "")
srr5 = srr5 & IIf(InStr(tr, "S") > 0, srr2, "")
srr5 = srr5 & IIf(InStr(tr, "X") > 0, srr3, "")
srr5 = srr5 & IIf(InStr(tr, "D") > 0, srr4, "")
For I = 1 To k
Randomize
srr6 = srr6 & Mid(srr5, Int(Rnd * Len(srr5) + 1), 1)
Next
GetSJzf = srr6
End Function
|