Jump to content

Extended Array Functions


Recommended Posts

Looks good, I'll have to try these out later. I have one question though, your Array shuffle seems kind of complicated, I wrote one myself a while ago that was rather simple, and I'm just wondering if there's any real difference between the two.

Here's mine:

Func _ArrayShuffle(ByRef $aArray, $iBase = 0, $iUBound = Default)
    If Not IsArray($aArray) Then Return SetError(1, 0, 0)
    If UBound($aArray, 0) <> 1 Then Return SetError(2, 0, 0)
    
    Local $temp, $rand
    If $iUBound = Default Or $iUBound = 0 Then $iUBound = UBound($aArray) - 1
    For $i = $iBase To $iUBound
        $temp = $aArray[$i]
        $rand = Random($iBase, $iUBound, 1)
        $aArray[$i] = $aArray[$rand]
        $aArray[$rand] = $temp
    Next
EndFunc

Okay, time for bed (5:30am)!

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...