Hello all,
I'm not the best when it comes to this, but i've been banging my head for days and i think its time i try to ask some of the very talented ppl i see on this site a quick question.
I stumbled across this post from about 2 months ago...
http://www.vbdotnetforums.com/vb-net-general-discussion/28669-basic-word-jumber.html
What that post is about is almost exactly what i need...except i dont want the characters in the individual words to be changed, i just need the whole words moved around. For example a text file/box that contains this "Jim Tire Tall2 G'night" would be "jumbled" or rearanged randomly to "Tall2 Jim G'night Tire". So far i have this code done, but it only gives me one word at a time, not all the words all at once.
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!
Matt
I'm not the best when it comes to this, but i've been banging my head for days and i think its time i try to ask some of the very talented ppl i see on this site a quick question.
I stumbled across this post from about 2 months ago...
http://www.vbdotnetforums.com/vb-net-general-discussion/28669-basic-word-jumber.html
What that post is about is almost exactly what i need...except i dont want the characters in the individual words to be changed, i just need the whole words moved around. For example a text file/box that contains this "Jim Tire Tall2 G'night" would be "jumbled" or rearanged randomly to "Tall2 Jim G'night Tire". So far i have this code done, but it only gives me one word at a time, not all the words all at once.
VB.NET:
Private Sub Button10_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button10.Click
Dim MyArray() As String = Split(testtxtbox1.Text, " ")
Dim I As Integer
Dim Index1 As Integer
Dim Index2 As Integer
Dim Temp As String
For I = 1 To 20
Index1 = Int(Rnd() * 10)
Index2 = Int(Rnd() * 10)
While Index1 = Index2
Index2 = Int(Rnd() * 10)
End While
Temp = MyArray(Index1)
MyArray(Index1) = MyArray(Index2)
MyArray(Index2) = Temp
Next I
testtxtbox2.Text = Temp
End Sub
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!
Matt