<%
' Kaynak: http://aspfaqs.com/webtech/110800-1.shtml
'****************************************
' This function randomly reorders the
' array aArray using a quick and dirty
' approach... It's fast!
'****************************************
Function ReOrderArrayQuickNDirty(ByVal aArray)
Dim iUpper, iLower, iLoop, iSwapPos, varTmp
iUpper = UBound(aArray)
iLower = LBound(aArray)
Randomize Timer
'Loop through the array, randomly swapping values
For iLoop = iLower to iUpper
'Get an array index to swap
iSwapPos = Int(Rnd * (iUpper + 1))
'Swap the current element with the element at iSwapPos
varTmp = aArray(iLoop)
aArray(iLoop) = aArray(iSwapPos)
aArray(iSwapPos) = varTmp
Next
ReOrderArrayQuickNDirty = aArray 'Return the jumbled array
End Function
Dim aSites
ReDim aSites(2)
aSites(0) = "4GuysFromRolla.com"
aSites(1) = "ASPMessageboard.com"
aSites(2) = "ASPFAQs.com"
'Display the array in-order
Dim iLoop
For iLoop = LBound(aSites) to UBound(aSites)
Response.Write aSites(iLoop) & "<BR>"
Next
response.write "<P>"
'Jumble up the array and display the new, random order!
aSites = ReOrderArrayQuickNDirty(aSites)
For iLoop = LBound(aSites) to UBound(aSites)
Response.Write aSites(iLoop) & "<BR>"
Next
%>