I need to get a random character out of a string.
Thanks.
I need to get a random character out of a string.
Thanks.
Get a random number 0 through the length of the string. Ask the string for the nth character.
Some things to try Googling:
Of course, add "VB.Net" to your search queries. Use what you know, find what you don't.
Dim str As String = "This is an example String"
Dim rnd As New Random(Date.Now.Millisecond)
Dim index As Int32 = rnd.Next(0, str.Length - 1)
Dim rndChar As Char = str(index)