Heya peeps, im back with my code of hell.

I would like to know if anyone knows the code to create a shuffle button by using the play button and a listview control.

My listview has tickboxes, so i imagine it would involve ticking them all and playing them randomly?

Wouldn't tickboxes indicate items to be played, so why would you go about ticking them all?

Create a temporary play list, and an item list with items that are left to be added. You randomly pick an item out of the to_add list, add it as the next item in the shuffle_play_list and remove it out of the to_add list.

Concept code:

while(to_add.size > 0)
{
  random_item = rand()%to_add.size;
  shuffle_play_list.add(to_add[random_item]);
  to_add.remove(random_item);
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.