Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.

list亂數

ex:

list內有n比資料

n+1

n+2

n+3

..

...

....

該如何將資料 亂數改變順序↓

ex:

n+4

n+1

n+2

n+6

..

...

....

還有

有2-n個list

該如何將裡面得資料串起來 顯示在另一個list內 且不可以重複

list1 list2 list3

n+1 m+1 z+1

n+2 m+2 z+2

n+3 m+3 z+3

另一個list內的資料顯視為

n+1m+1z+2

n+2m+3z+2

以此

在此先感謝

Update:

為何妳有些部份程式碼 是會有錯誤的-.-

1 Answer

Rating
  • 10 years ago
    Favorite Answer

    Randomize()

    '第1種亂數

    'For i As Integer = 0 To 100

    ' Dim strTemp = String.Empty

    ' Dim Rindex = CInt(Rnd() * (list1.Count - 1))

    ' strTemp = list1(0)

    ' list1(0) = list1(Rindex)

    ' list1(Rindex) = strTemp

    'Next

    '第2種亂數

    Dim list2 As New List(Of String)

    Do Until (list1.Count = 0)

    Dim Rindex = CInt(Rnd() * (list1.Count - 1))

    list2.Add(list1(Rindex))

    list1.RemoveAt(Rindex)

    Loop

    '該如何將裡面得資料串起來 顯示在另一個list內 且不可以重複

    Dim list3 As New List(Of String)'有幾個listy就For Each幾次

    '=====================

    For Each s In list2

    list3.Add(s)

    Next'=====================

    另一個list內的資料為相同index字串的相加

    Dim list4 As New List(Of String)

    For i = 0 To list2.Count - 1

    list4.Add(list2(i) + list3(i))

    Next

Still have questions? Get your answers by asking now.