Same concept, almost same code:
Code:
Private r As New Random
Private Function RandomizeWords(ByVal text As String) As String
Dim words As New List(Of String)(text.Split(" "c))
Dim newwords As New List(Of String)
For Each word As String In words
newwords.Insert(r.Next(0, newwords.Count + 1), word)
Next
Return String.Join(" ", newwords.ToArray)
End Function
Quote:
|
One last thing....lets say there are 1000 words in this text file that i want to "jumble" up - but out of those 1000 words i specify in the program that i want only 500 random words out of that 1000 word file. Any ideas? Thanks in advance everyone!
|
For example take 500 random picks from that "words" variable in example, remove the picked item as you go.