Public Function rndLong(ByVal lngLength As Long) As Long
Dim b() As Byte, keyArr1() As Byte, keyArr2() As Byte
Dim i As Long, tmpStr As String
Let keyArr1 = "0123456789"
Let keyArr2 = "123456789"
ReDim b(1 To lngLength * 2)
Let b(1) = keyArr2(Int(((UBound(keyArr2) + 1) \ 2) * Rnd + 1) * 2 - 2)
For i = 3 To lngLength * 2 Step 2
Let b(i) = keyArr1(Int(((UBound(keyArr1) + 1) \ 2) * Rnd + 1) * 2 - 2)
Next
Let tmpStr = b
Let rndLong = tmpStr
End Function
Sub foo()
Dim i As Long
For i = 1 To 100
Debug.Print rndLong(6)
Next
End Sub