應用: 樸克片洗牌, 亂數排列陣列裏的值
Randomize()
For i As Integer = 0 To UBound(ExamAns)
Dim j As Integer = Rnd() * UBound(ExamAns)
Dim tmp As String = ExamAns(i)
ExamAns(i) = ExamAns(j)
ExamAns(j) = tmp
Next
For i As Integer = 0 To UBound(ExamAns)
Dim j As Integer = Rnd() * UBound(ExamAns)
Dim tmp As String = ExamAns(i)
ExamAns(i) = ExamAns(j)
ExamAns(j) = tmp
Next
沒有留言:
張貼留言