没这必要,直接用一个有效的区域代码就行了,生日后面还有四位呢,意思是一天就可以有999个号码,重复的机率很低... Func ranidcard()
$STR = "11000,11022,12022,13013,13022,13042,13052,13062,13068,13073,13092,13102,14010,14022,14042,14062,14082,14092,14103,15010,15022,15050,15070,15222,15262,21010,21021,21041,21070,21090,21112,21140,22020,22040,22062,22240,23012,23022,23040,23060,23071,23090,23112,23272,31012,32020,32038,32058,32072,32092,32118,33010,33022,33040,33070,33090,33112,34020,34040,34072,34102,34122,34150,34182,35018,35040,35052,35070,35090,36012,36042,36070,36080,36092,36110,37011,37030,37050,37070,37083,37110,37132,37152,37172,41018,41030,41048,41070,41082,41102,41130,41142,41162,42010,42020,42052,42070,42100,42118,42282,43020,43040,43052,43070,43092,43112,43123,44010,44022,44050,44070,44092,44138,44162,44188,44532,45020,45032,45050,45088,45102,45122,46010,46903,50011,50023,51011,51032,51060,51081,51110,51132,51152,51180,51208,51332,51342,52011,52032,52222,52242,52270,53012,53040,53060,53232,53253,53272,53310,53352,54212,54230,54242,54262,61012,61033,61050,61062,61080,61092,62010,62050,62072,62100,62262,62302,63212,63262,64010,64032,65012,65232,65292,65312,65402,65432"
$dizi = StringSplit($STR, ",")
$dizi2 = Random(1, $dizi - 1, 1)
$dizi = $dizi[$dizi2] & Random(0, 9, 1)
$year = Random(1968, 1990, 1)
$moth = Random(1, 12, 1)
If $moth < 10 Then
$moth = "0" & $moth
EndIf
$days = Random(1, 28, 1)
If $days < 10 Then
$days = "0" & $days
EndIf
$xuhao = Random(1, 999, 1)
If $xuhao < 10 Then
$xuhao = "00" & $xuhao
ElseIf $xuhao >= 10 And $xuhao < 100 Then
$xuhao = "0" & $xuhao
EndIf
$17 = $dizi & $year & $moth & $days & $xuhao
Dim $iden = StringSplit($17 & "0", "", 2)
If StringLower($iden) = "x" Then $iden = 10
Dim $weighing = 0
For $i = UBound($iden) - 2 To 0 Step -1
$weighing += $iden[$i] * (2 ^ (UBound($iden) - $i - 1))
Next
$ma = Mod(12 - Mod($weighing, 11), 11)
$18 = $17 & $ma
Return $18
EndFunc ;==>ranidcard
Func code()
Local $areas = "330302河南省灵宝市城关镇西华村/" & _
"330302河南省灵宝市城关镇建设村/" & _
"330302河南省灵宝市城关镇解放村/" & _
"330302河南省灵宝市城关镇涧东村/" & _
"330302河南省灵宝市城关镇东关村/" & _
"330302河南省灵宝市城关镇五龙村/" & _
"330302河南省灵宝市城关镇南田村/" & _
"330302河南省灵宝市城关镇北田村/" & _
"330302河南省灵宝市城关镇牛庄村/" & _
"330302河南省灵宝市尹庄镇尹庄/" & _
"330302河南省灵宝市尹庄镇阎李/" & _
"330302河南省灵宝市尹庄镇浊峪/" & _
"330302河南省灵宝市尹庄镇辛庄/" & _
"330302河南省灵宝市尹庄镇涧口/" & _
"330302河南省灵宝市尹庄镇大岭/" & _
"330302河南省灵宝市尹庄镇杏洼/" & _
"330302河南省灵宝市尹庄镇官庄/" & _
"330302河南省灵宝市尹庄镇李村/" & _
"330302河南省灵宝市尹庄镇留村/" & _
"330302河南省灵宝市尹庄镇唐窑/" & _
"330302河南省灵宝市尹庄镇寺洼/" & _
"330302河南省灵宝市尹庄镇娄下/" & _
"330302河南省灵宝市尹庄镇东车/" & _
"330302河南省灵宝市尹庄镇车窑/" & _
"330302河南省灵宝市尹庄镇尹庄/" & _
"330302河南省灵宝市尹庄镇西车/" & _
"330302河南省灵宝市尹庄镇思平/" & _
"330302河南省灵宝市尹庄镇涧西/" & _
"330302河南省灵宝市尹庄镇岳渡/" & _
"330302河南省灵宝市尹庄镇南滩/" & _
"330302河南省灵宝市尹庄镇前店/" & _
"330302河南省灵宝市尹庄镇杨公寨/" & _
"330302河南省灵宝市尹庄镇张家湾/" & _
"330302河南省灵宝市尹庄镇南嶥山/" & _
"330302河南省灵宝市尹庄镇北嶥山/" & _
"330302河南省灵宝市尹庄镇大中原/" & _
"330302河南省灵宝市尹庄镇开方口/" & _
"330302河南省灵宝市尹庄镇伍洞沟/" & _
"330302河南省灵宝市尹庄镇小中原/" & _
"330302河南省灵宝市朱阳镇朱阳村/" & _
"330302河南省灵宝市朱阳镇后河/" & _
"330302河南省灵宝市朱阳镇运头/" & _
"330302河南省灵宝市朱阳镇贾村/" & _
"330302河南省灵宝市朱阳镇营里/" & _
"330302河南省灵宝市朱阳镇匣里/" & _
"330302河南省灵宝市朱阳镇董寨/" & _
"330302河南省灵宝市朱阳镇寺上/" & _
"330302河南省灵宝市朱阳镇小河/" & _
"330302河南省灵宝市朱阳镇芋园/" & _
"330302河南省灵宝市朱阳镇大村/" & _
"330302河南省灵宝市朱阳镇下河/" & _
"330302河南省灵宝市朱阳镇周官/" & _
"330302河南省灵宝市朱阳镇高会/" & _
"330302河南省灵宝市朱阳镇透山/" & _
"330302河南省灵宝市朱阳镇双庙/" & _
"330302河南省灵宝市朱阳镇美山/" & _
"330302河南省灵宝市朱阳镇秦池/" & _
"330302河南省灵宝市朱阳镇干沟/" & _
"330302河南省灵宝市朱阳镇黑山/" & _
"330302河南省灵宝市朱阳镇何家村/" & _
"330302河南省灵宝市朱阳镇卢子垣/" & _
"330302河南省灵宝市朱阳镇吴家垣/" & _
"330302河南省灵宝市朱阳镇阎家驮/" & _
"330302河南省灵宝市朱阳镇南新店/" & _
"330302河南省灵宝市朱阳镇老虎沟/" & _
"330302河南省灵宝市朱阳镇南庄里/" & _
"330302河南省灵宝市朱阳镇石坡湾/" & _
"330302河南省灵宝市朱阳镇蒲陈沟/" & _
"330302河南省灵宝市朱阳镇麻林河/" & _
"330302河南省灵宝市朱阳镇犁牛河/" & _
"330302河南省灵宝市朱阳镇鱼仙河/" & _
"330302河南省灵宝市朱阳镇王家村/" & _
"330302河南省灵宝市朱阳镇两岔河/" & _
"330302河南省灵宝市朱阳镇麻家河/" & _
"330302河南省灵宝市朱阳镇果园头/" & _
"330302河南省灵宝市朱阳镇梁家庄/" & _
"330302河南省灵宝市朱阳镇柿树岭/" & _
"330302河南省灵宝市朱阳镇董家埝/" & _
"330302河南省灵宝市朱阳镇周家河/" & _
"330302河南省灵宝市朱阳镇杨家河/" & _
"330302河南省灵宝市阳平镇阌乡/" & _
"330302河南省灵宝市阳平镇坡底/" & _
"330302河南省灵宝市阳平镇张村/" & _
"330302河南省灵宝市阳平镇横涧/" & _
"330302河南省灵宝市阳平镇嘴头/" & _
"330302河南省灵宝市阳平镇下庄/" & _
"330302河南省灵宝市阳平镇庙底/" & _
"330302河南省灵宝市阳平镇乔营/" & _
"330302河南省灵宝市阳平镇下原/" & _
"330302河南省灵宝市阳平镇桑园/" & _
"330302河南省灵宝市阳平镇大湖/" & _
"330302河南省灵宝市阳平镇水峪/" & _
"330302河南省灵宝市阳平镇湖东/" & _
"330302河南省灵宝市阳平镇郎寨/" & _
"330302河南省灵宝市阳平镇中社/" & _
"330302河南省灵宝市阳平镇五留/" & _
"330302河南省灵宝市阳平镇东坡/" & _
"330302河南省灵宝市阳平镇西常/" & _
"330302河南省灵宝市阳平镇裴张/" & _
"330302河南省灵宝市阳平镇东常/" & _
"330302河南省灵宝市阳平镇涧沟/" & _
"330302河南省灵宝市阳平镇沟南/" & _
"330302河南省灵宝市阳平镇大寨/" & _
"330302河南省灵宝市阳平镇东营/" & _
"330302河南省灵宝市阳平镇北沟/" & _
"330302河南省灵宝市阳平镇娄底/" & _
"330302河南省灵宝市阳平镇强家/" & _
"330302河南省灵宝市阳平镇北阳平/" & _
"330302河南省灵宝市阳平镇南阳平/" & _
"330302河南省灵宝市阳平镇徐家营/" & _
"330302河南省灵宝市阳平镇九龙营/" & _
"330302河南省灵宝市阳平镇王家埝/" & _
"330302河南省灵宝市故县镇故县/" & _
"330302河南省灵宝市故县镇河西/" & _
"330302河南省灵宝市故县镇盘东/" & _
"330302河南省灵宝市故县镇赵村/" & _
"330302河南省灵宝市故县镇郭村/" & _
"330302河南省灵宝市故县镇芦苔/" & _
"330302河南省灵宝市故县镇帝王/" & _
"330302河南省灵宝市故县镇进家/" & _
"330302河南省灵宝市故县镇里村/" & _
"330302河南省灵宝市故县镇盘西/" & _
"330302河南省灵宝市故县镇城东/" & _
"330302河南省灵宝市故县镇神底/" & _
"330302河南省灵宝市故县镇张姚/" & _
"330302河南省灵宝市故县镇桃村/" & _
"330302河南省灵宝市故县镇六口/" & _
"330302河南省灵宝市故县镇西庄/" & _
"330302河南省灵宝市故县镇高柏/" & _
"330302河南省灵宝市故县镇孔家营/" & _
"330302河南省灵宝市故县镇冯家原/" & _
"330302河南省灵宝市故县镇李家沟/" & _
"330302河南省灵宝市故县镇张家山/" & _
"330302河南省灵宝市故县镇尚家湾/" & _
"330302河南省灵宝市故县镇上坡头/" & _
"330302河南省灵宝市故县镇安家底/" & _
"330302河南省灵宝市故县镇薛家营/" & _
"330302河南省灵宝市故县镇红花寨/" & _
"330302河南省灵宝市豫灵镇/" & _
"330302河南省灵宝市大王镇/" & _
"330302河南省灵宝市阳店镇/" & _
"330302河南省灵宝市函谷关镇墙底/" & _
"330302河南省灵宝市函谷关镇岸底/" & _
"330302河南省灵宝市函谷关镇西留/" & _
"330302河南省灵宝市函谷关镇梁村/" & _
"330302河南省灵宝市函谷关镇店头/" & _
"330302河南省灵宝市函谷关镇王垛/" & _
"330302河南省灵宝市函谷关镇孟村/" & _
"330302河南省灵宝市函谷关镇东寨/" & _
"330302河南省灵宝市函谷关镇西寨/" & _
"330302河南省灵宝市函谷关镇稠桑/" & _
"330302河南省灵宝市函谷关镇坡头寨/" & _
"330302河南省灵宝市函谷关镇雷家沟/" & _
"330302河南省灵宝市函谷关镇白家寨/" & _
"330302河南省灵宝市函谷关镇马家寨/" & _
"330302河南省灵宝市函谷关镇梨湾原/" & _
"330302河南省灵宝市函谷关镇长安寨/" & _
"330302河南省灵宝市函谷关镇北坡头/" & _
"330302河南省灵宝市焦村镇/" & _
"330302河南省灵宝市川口乡/" & _
"330302河南省灵宝市寺河乡/" & _
"330302河南省灵宝市苏村乡/" & _
"330302河南省灵宝市五亩乡/" & _
"330302河南省灵宝市西阎乡/" & _
"330301河南省卢氏县城关镇/" & _
"330301河南省卢氏县杜关镇/" & _
"330301河南省卢氏县五里川镇/" & _
"330301河南省卢氏县官道口镇/" & _
"330301河南省卢氏县朱阳关镇/" & _
"330301河南省卢氏县官坡镇/" & _
"330301河南省卢氏县范里镇/" & _
"330301河南省卢氏县东明镇/" & _
"330301河南省卢氏县文峪乡/" & _
"330301河南省卢氏县横涧乡/" & _
"330301河南省卢氏县磨沟口乡/" & _
"330301河南省卢氏县双槐树乡/" & _
"330301河南省卢氏县汤河乡/" & _
"330301河南省卢氏县瓦窑沟乡/" & _
"330301河南省卢氏县狮子坪乡/" & _
"330301河南省卢氏县沙河乡/" & _
"330301河南省卢氏县徐家湾乡/" & _
"330301河南省卢氏县潘河乡/" & _
"330301河南省卢氏县木桐乡"
$ThisYear = _NowCalcDate() ;当前年月日
$pp = StringSplit($ThisYear, "/") ;以/为分割符拆分字符串
$TheYear = $pp ;当前年份
$mm = $pp ;当前月份
$mm = Int($mm) ;月份整数化
$dd = $pp ;当前日期
$dd = Int($dd) ;日期整数化
$max = $TheYear - 19 ;最大年龄
$min = $TheYear - 40 ;最小年龄
$nyear = Random($min, $max, 1) ;随即获得一个最大年龄和最小年龄之间的数据
$nmm = Random(1, 12, 1) ;随即获得一个月份
Local $nddmax ;每月的最大天数
Select
Case $nmm = 1 Or $nmm = 3 Or $nmm = 5 Or $nmm = 7 Or $nmm = 8 Or $nmm = 10 Or $nmm = 12
$nddmax = 31
Case $nmm = 4 Or $nmm = 6 Or $nmm = 9 Or $nmm = 11
$nddmax = 30
EndSelect
If $nmm = 2 Then
If _DateIsLeapYear(@YEAR) Then ;如果该年是闰年
$nddmax = 29
Else
$nddmax = 28
EndIf
EndIf
$ndd = Random(1, $nddmax, 1) ;随即生成一个日期
$age1 = $TheYear - $nyear ;算出年龄
If $nmm > $mm Then ;算出年龄
$age = $age1 - 1
ElseIf $nmm = $mm Then
If $ndd > $dd Then
$age = $age1 - 1
Else
$age = $age1
EndIf
Else
$age = $age1
EndIf
If $nmm < 10 Then $nmm = "0" & $nmm
If $ndd < 10 Then $ndd = "0" & $ndd
$order1 = Random(0, 9, 1)
$order2 = Random(0, 9, 1)
$order3 = Random(1, 9, 1)
;If _MathCheckDiv($order3, 2) = 2 Then $sex = "女"
;If _MathCheckDiv($order3, 2) = 1 Then $sex = "男"
$tmp = StringSplit($areas, "/", 1)
$u = Random(1, $tmp, 1)
$e = $tmp[$u]
$area = StringMid($e, 1, 6)
$ch = StringMid($e, 7)
$IDCardCode = $area & $nyear & $nmm & $ndd & $order1 & $order2 & $order3
$LastNum = cheknum($IDCardCode)
$IDCardCode2 = $IDCardCode & $LastNum
Return $IDCardCode2
EndFunc ;==>code
Func cheknum($IDCardCodes)
Local $_numer
$_a = StringSplit($IDCardCodes, "", 0)
$_t1 = $_a * 7
$_t2 = $_a * 9
$_t3 = $_a * 10
$_t4 = $_a * 5
$_t5 = $_a * 8
$_t6 = $_a * 4
$_t7 = $_a * 2
$_t8 = $_a * 1
$_t9 = $_a * 6
$_t10 = $_a * 3
$_t11 = $_a * 7
$_t12 = $_a * 9
$_t13 = $_a * 10
$_t14 = $_a * 5
$_t15 = $_a * 8
$_t16 = $_a * 4
$_t17 = $_a * 2
$_Tmp = $_t1 + $_t2 + $_t3 + $_t4 + $_t5 + $_t6 + $_t7 + $_t8 + $_t9 + $_t10 + $_t11 + $_t12 + $_t13 + $_t14 + $_t15 + $_t16 + $_t17
$_Tmp1 = Int($_Tmp / 11)
$_Tmp2 = $_Tmp1 * 11
$_Tmp3 = $_Tmp - $_Tmp2
Select
Case $_Tmp3 = 0
$_numer = 1
Case $_Tmp3 = 1
$_numer = 0
Case $_Tmp3 = 2
$_numer = "x"
Case $_Tmp3 = 3
$_numer = 9
Case $_Tmp3 = 4
$_numer = 8
Case $_Tmp3 = 5
$_numer = 7
Case $_Tmp3 = 6
$_numer = 6
Case $_Tmp3 = 7
$_numer = 5
Case $_Tmp3 = 8
$_numer = 4
Case $_Tmp3 = 9
$_numer = 3
Case $_Tmp3 = 10
$_numer = 2
EndSelect
Return ($_numer)
EndFunc ;==>cheknum
http://iask.sina.com.cn/b/9747167.html
规范
http://www.docin.com/p-123353886.html
地区代码 学习一下~~~~~~~~~~~~~ 看看帖子学习学习
页:
1
[2]