CodeItBetter Programming Another VB Programming Blog

How to Scramble Word – Guaranteed different every time.

Posted on September 5, 2011
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
'String Manipulation - How to Scramble Word - Guaranteed different every time.
Public Function ScrambleWord(Word)
    Randomize
    Length = Len(Word)
    ReDim Letter(Length)
    For I = 1 To Length
5       RndSlot = Int(Rnd * Length) + 1
        If RndSlot = Length + 1 Or Letter(RndSlot) <> "" Then
            GoTo 5
        Else
            Letter(RndSlot) = Mid$(Word, I, 1)
        End If
    Next I
    For I = 1 To Length
        Scrambled = Scrambled & Letter(I)
    Next I
    ScrambleWord = Scrambled
End Function
Comments (0) Trackbacks (0)

No comments yet.


Leave a comment


 

No trackbacks yet.