Private Sub Command1_Click()
Dim r As Integer, k1 As Integer, k2 As Integer
Dim s As String, n As Integer
'从文本框TxtIn中获取字符串
Randomize
r = Int(Rnd() * 10) + 1 '随机生成洗牌次数
n = Len(s)
Do While r >= 1 '洗牌操作
k1 = Int(Rnd() * (n - 2)) + 2
k2 = Int(Rnd() * (n - k1 + 1)) + k1
s = + Mid(s, 1, k1 - 1) + Mid(s, k2 + 1, n - k2)
r = r - 1
Loop
TxtOut.Text = s ' 在文本框TxtOut中输出结果
End Sub