Jump to content
Sign in to follow this  
4nt1h4cker

Extended Array Functions

Recommended Posts

4nt1h4cker

Hi @ all,

some array Funtions took from php. Written by me.

_ArrayCall

_ArrayDiff

_ArraySum

_ArraySortWith

_ArraySplice

_ArraySlice

_ArrayRand

_ArrayShuffle

myarrayfuncs.au3

Edited by 4nt1h4cker

Share this post


Link to post
Share on other sites
therks

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)!

Share this post


Link to post
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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.