Hi, I've created a small tool to upload binary files to Usenet newsgroups. Every binary file is cut into smaller pieces (about 400kB) and then uploaded to the newsserver. Every piece has its own code (Message-ID) that I put in the header.
I create Message-ID's of about 45 characters. When creating random strings of about 45 characters there should be billions of combinations, but many of my users get incomplete uploads, because the application creates Message-ID's already created/used by other users.Code:[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
Why do so many people create the same strings? Is it because of the Randomize in the function instead of the form_load event?
This is the code I use to create the Message-ID.
vb Code:
Private Const CHARS = "123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" Private Function RandomString() As String Dim i As Long Dim tmp As String Randomize For i = 1 To 28 tmp = tmp & Mid(CHARS, Int(52 * Rnd) + 1, 1) Next i RandomString = tmp & "@application.local" End Function
I also tried this function, but the same problem occurs.
vb Code:
Public Function RandomString() As String Dim i As Long Dim btByte As Byte Randomize For i = 1 To 28 btByte = Int(Rnd() * 127) Select Case btByte Case 48 To 57 RandomString = RandomString & Chr(btByte) Case 65 To 90 RandomString = RandomString & Chr(btByte) Case 97 To 122 RandomString = RandomString & Chr(btByte) Case Else i = i - 1 End Select Next i RandomString = RandomString & "@application.local" End Function
