Eurax

Download Anything For Free

Scramble Kata / acak kata

akhirnya dpt jg caranya... meskipun ga ada algoritmanya sih :P
neh......
Private Sub Command1_Click()
Dim x, pos As Integer
Dim char As String
Dim s() As String

'Re-dimension the array to the size of the string in the textbox
ReDim s(Len(TextBox1.Text)) As String

'Assign each character to an element in the array
For x = 1 To Len(TextBox1.Text)
s(x) = Mid(TextBox1.Text, x, 1)
Next

'For 1 to the size of the array, mix up the letters
For x = 1 To UBound(s)
'Pos is a random place in the array
pos = Int((Len(TextBox1.Text) - 1) * Rnd) + 1

'temporarily assign the temp character to our random letter
char = s(pos)

'Swap the characters, using the temp character to assign from the overwriten
'element
s(pos) = s(x)
s(x) = char
Next

'Clear the textbox and concat the value with each element in the array
TextBox1.Text = ""
For x = 1 To UBound(s)
TextBox1.Text = TextBox1.Text & s(x)
Next
End Sub

selengkapnya di : http://digiassn.blogspot.com/

0 komentar: