GenerateRandom

Generates a random string, returns string passed, then full date, then 8-chars random string
Like in wetfile-2018-09-12-TGR45R4A

CodeFunctionName
What is this?

Public

Tested

Original Work
Public Function GenerateRandom(SystemText)
Dim sb As New StringBuilder
Dim r As New Random
Dim idx As Integer
Dim s As String = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
Randomize()
For i As Integer = 1 To 8
Randomize()
idx = r.Next(0, 35)
sb.Append(s.Substring(idx, 1))
Next
Dim cSuffixName As String = Hex(CLng(Now.Ticks))
Return SystemText & "-" & Format(Date.Today, "yyyy-MM-dd") & "-" & sb.ToString
End Function

SystemText

GenerateRandomFilename("wetfile")
returns
wetfile-2018-09-12-TGR45R4

Views 3,778

Downloads 1,443

CodeID
DB ID

ANmarAmdeen
618
Attachments
Revisions

v1.0

Wednesday
September
12
2018