|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Random StringHi All,
I am looking for a way to generate a 8 character random string. The range of characters can be from a-z, A-Z. Does anyone know a quick and efficient way of doing this? Regards Mick "Materialised" <materiali***@privacy.net> schrieb See:> Hi All, > > I am looking for a way to generate a 8 character random string. The > range of characters can be from a-z, A-Z. Does anyone know a quick > and efficient way of doing this? - System.Random - Microsoft.VisualBasic.Strings.Chr - System.Text.StringBuilder Armin Public Function RandomString(ByVal length As Integer) As String
Dim rd As New Random(Convert.ToInt32(DateTime.Now.Ticks Mod Integer.MaxValue)) Dim st(length - 1) As Byte Dim i As Integer For i = 0 To st.Length - 1 If rd.Next(0, 2) = 0 Then st(i) = CByte(rd.Next(65, 91)) Else st(i) = CByte(rd.Next(97, 123)) End If Next Return Encoding.Default.GetString(st) End Function Show quoteHide quote "Materialised" <materiali***@privacy.net> wrote in message news:42hgqjF1j9pq4U1@individual.net... > Hi All, > > I am looking for a way to generate a 8 character random string. The range > of characters can be from a-z, A-Z. Does anyone know a quick and efficient > way of doing this? > > Regards > Mick >
VB2005 - Stop User from Leaving Row in DataGridView
vs2005 - Why all the errors? yet the code works. Foreign Characters in XML Cell validating event problem. Multiple columns in Combobox list ObjectContext problem Insert Column in Excel in VB .NET Old value of a datagridview combobox cell Converting from VB6 to VB.NET 2003 Sending E-Mail from User's Machine |
|||||||||||||||||||||||