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
  • 750
  • 7
  • 23

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,447
  • 3
  • 45
  • 74