SIGN UP MEMBER LOGIN:    
Blog

Generate random strings in array

Posted by Hirendra Sisodiya Blogs | Visual Basic 2010 Oct 23, 2010
how to generate random strings with specified length and charecters in array
if you want to generate random strings in array with n length and specified characters than you can use this code:

suppose i want to generate 10 strings in array that contains charecters among  (A,B,C,D,E)  with length 3.
 

Dim chars As String() = {"A", "B", "C", "D", "E", "F"}
Dim tempRandom As New Random
Dim RandomStrings(10) As String
For i As Integer = 0 To 10
RandomStrings(i) = chars(tempRandom.Next(0, 5)) & chars(tempRandom.Next(0, 5)) & chars(tempRandom.Next(0, 5))
Next
share this blog :
post comment