VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Scramble function, takes a specified string and randomly scrambles it.

by A.J. (1 Submission)
Category: String Manipulation
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Sun 17th December 2000
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Scramble function, takes a specified string and randomly scrambles it.

Rate Scramble function, takes a specified string and randomly scrambles it.



Dim g, i, position As Integer
Dim letter, newword As String
g = Len(word)

ReDim scram(1 To g)
 For i = 1 To g
  scram(i) = ""
Next i

For i = 1 To g
letter = Mid(word, i, 1)

Randomize
Do
 position = Int(Rnd * Len(word)) + 1
  Loop Until scram(position) = ""
  scram(position) = letter

Next i

For i = 1 To g
newword = newword & scram(i)
Next i
scramble = newword
End Function

Download this snippet    Add to My Saved Code

Scramble function, takes a specified string and randomly scrambles it. Comments

No comments have been posted about Scramble function, takes a specified string and randomly scrambles it.. Why not be the first to post a comment about Scramble function, takes a specified string and randomly scrambles it..

Post your comment

Subject:
Message:
0/1000 characters