Local $array[10]=[0]
Local $i
Local $str = ""
For $i = 0 To UBound($array)-1
$array[$i] = Random(0, 100, 1)
$str &= $array[$i] & ","
Next
$str =StringTrimRight($str, 1)
$str = "随机生成的数据:" & @CRLF & $str & @CRLF & @CRLF
Local $j
Local $index
Local $last = UBound($array)-1
Local $tmp
While $last>0
For $i=0 To $last
$str &= $array[$i] & ", "
Next
$str &= ",,,取出,,,"
$index = Random(0, $last, 1)
If $index <> $last Then
$tmp = $array[$last]
$array[$last] = $array[$index]
$array[$index] = $tmp
EndIf
$str &= $array[$last] & "," & @CRLF
$last -= 1
WEnd
MsgBox(0, "随机生成的数据", $str & $array[$last])
|