Sign in to follow this  
Followers 0
Rad

I need _ArrayShuffle()

2 posts in this topic

Ok, So I am making a playlist editor (Not one for WMP or winamp, its for a flash playlist)

Its all done, but I really want to make a Shuffle button...

It sounded easy at first, but now its getting complicated. Each item in the playlist has several variables attached to it (via arrays...)

It needs to shuffle only the first array, meaning that $array[1][2] and $array[1][3] would still have the same values attached to each other, so if it changed... $array[x][2] and $array[x][3] would still have the same values as before. Just with a different position.

The way I built my program will rely on this method

Now, as far as the programming goes... I had a few ideas, and they all failed miserably. One, was to make a string of each array element and then assign that element to a new array in a random position, and then to make sure it doesn't overwrite a value, remove the array from the string.

This had alot of problems, simple problems and some that I just couldn't find.

Next, I made an array and assigned names to each of them. Basically doing the same as last time, except removing an array element instead of a string. That was even worse...

So yeah, I'm about to give up until something hits me or someone else helps me out :)

Now, the program itself is really unorganized, but it works... So I went through the trouble of making a little script here, that if someone can help me make it work, I could change a bit and make work for my program ;)

#include <GUIConstants.au3>
#include <Array.au3>

Dim $List[5][2]

$List[0][0] = "Bob"
$List[0][1] = "is cool"
$List[1][0] = "Sue"
$List[1][1] = "is a girl"
$List[2][0] = "Jordan"
$List[2][1] = "is a guy"
$List[3][0] = "asdf"
$List[3][1] = "sadfsdljfasdfkhasdfh!!"
$List[4][0] = "Rad"
$List[4][1] = "obviously isn't creative"

_ArrayDisplay($list, "BEFORE")

_ArrayShuffle($list)

_ArrayDisplay($list, "AFTER")

Func _ArrayShuffle(ByRef $list)
    local $ListTWO[ubound($list) - 1]
    For $i = 0 to ubound($list) - 1
        
    Next
EndFunc

Share this post


Link to post
Share on other sites



<{POST_SNAPBACK}> click the snap back arrow this might help you.. :)


 

Spoiler

shoot_zpsfd329d66.png
dontbelieveeverythingyouthink_zps0e1e900

Madness is the first step to understanding...

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  
Followers 0