I need to generate a pattern of random string for each file name in a specific directory.
but i don't know why i have a duplicate result!
Code:Option Explicit Private Const C_EKEY As Double = 1.123 Public Function sRandomString(iLength As Integer, ByVal strSeed As String) As String Dim i As Integer Dim j As Integer Dim s As String Static b As Boolean Dim lngX As Long Dim lngI As Long Dim strMap As String Dim strPWD As String For lngX = 1 To Len(strSeed) lngI = lngI + Asc(Mid$(strSeed, lngX, 1)) Next lngX Rnd -1 Randomize CInt(lngI * C_EKEY) Do Until j = iLength i = Int(100 * Rnd + 36) s = s + Chr$(i) j = j + 1 Loop sRandomString = s End Function




Reply With Quote
