首页 > 代码库 > 将字符串打乱输出

将字符串打乱输出

Dim i,mm,Str,StrPosition,NewStr
Str = "1234567890"
For i=1ToLen(Str)
    StrPosition = GetRandomMath(1,Len(Replace(Str,mm,"")))
    Str = Replace(Str,mm,"")
    mm = Mid(str,StrPosition,1)
    NewStr = NewStr & mm
Next
WScript.Echo "NewStr = " & NewStr

Function GetRandomMath(begin,over)
    Randomize
    GetRandomMath = Int((Rnd * (over - begin + 1)) + begin)
EndFunction

将字符串打乱输出