hey
i am using the below function to generate a random string of x amount of charactors:
problem is every time i call the function it produce the same output each time.. not random at allCode:Function RandomString(ByVal mask As String) As String Dim i As Integer Dim acode As Integer Dim options As String Dim char As String ' initialize result with proper lenght RandomString = mask For i = 1 To Len(mask) ' get the character char = Mid$(mask, i, 1) Select Case char Case "?" char = Chr$(1 + Rnd * 127) options = "" Case "#" options = "0123456789" Case "A" options = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" Case "N" options = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0" _ & "123456789" Case "H" options = "0123456789ABCDEF" Case Else options = "" End Select If Len(options) Then char = Mid$(options & Right$(options, 1), 1 + Int(Rnd * Len(options) _ ), 1) End If Mid(RandomString, i, 1) = char Next End Function




Reply With Quote