0

I am trying to create a shuffle play feature for a music streaming app and I'm trying to figure out the best way to create this. I want to be able to shuffle through an array by selecting a random index but not selecting one that has already been selected. I can think of a few ways to do this but none seem very elegant. Has this problem been solved before? Is there a simple solution to this?

Thanks

Andy
  • 740
  • 7
  • 22

1 Answers1

0

might be simpler to just randomly shuffle the array (or a copy of it), then just keep popping them off the back of the array

Fonix
  • 11,049
  • 2
  • 43
  • 69