igotandrew Posted January 2, 2009 Share Posted January 2, 2009 I'm just not in the thinking mood today, or something. I searched it, it came in a function for 2d arrays, I tried to get it down to one. Func ArrShuffle(ByRef $myArray) Local $temp[1] = [0], $X = 1 Local $numElements = Ubound($myArray) - 1 ;Loop through all array elements For $X = 1 to $numElements ;Store copy of current element $temp[0] = $myArray[$X] ;MsgBox(0, 0, "$temp[0] = " & $myArray[$X]) $random = Random($X, $numElements, 1) ;MsgBox(0, 0, "Random number = " & $Random) ;Overwrite current element with random element $myArray[$X] = $myArray[$random] ;MsgBox(0, 0, "$myArray[$X] = " & $myArray[$x] & " - swapped data w/ " & $random) ;Overwrite random element with original copy of current element $myArray[$random] = $temp[0] Next EndFunc ;==>ArrShuffle sometimes, it'll also shuffle the 0 entry, which in most of my cases is the number of entries. So I end up with array problems, when trying to fix it. Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted January 2, 2009 Moderators Share Posted January 2, 2009 http://www.autoitscript.com/forum/index.ph...st&p=573531 Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
igotandrew Posted January 2, 2009 Author Share Posted January 2, 2009 http://www.autoitscript.com/forum/index.ph...st&p=573531Thanks~Time to analyze and see what I did wrong. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now