Here is code that sorts arrays: havent tried it with numbers but it should work..
Make a copy of the random array.. sort the copy..
then compare Sorted to original.. creating an array with the index order?
sounds like it might work... but, there is probably a better waylol
sort code:
VB Code:
'Author: CVMichael 'Thread: [url]http://www.vbforums.com/showthread.php?t=231925[/url] Private Sub QuickSort(C() As String, ByVal First As Long, ByVal Last As Long) Dim Low As Long, High As Long Dim MidValue As String Low = First High = Last MidValue = C((First + Last) \ 2) Do While C(Low) < MidValue Low = Low + 1 Wend While C(High) > MidValue High = High - 1 Wend If Low <= High Then Swap C(Low), C(High) Low = Low + 1 High = High - 1 End If Loop While Low <= High If First < High Then QuickSort C, First, High If Low < Last Then QuickSort C, Low, Last End Sub Private Sub Swap(ByRef A As String, ByRef B As String) Dim T As String T = A A = B B = T End Sub




lol
Reply With Quote