I am trying to make a music player app. For the shuffle option in the app ,
let's say when one song is completed, I use the Random function to generate a number from the list of the songs' ID.
Random r=new Random();
int i1= r.nextInt(songs.newCurrentPlayList.size()-1);
songs.newCurrentPlayingSongItemInPlaylist=i1;
Using this method, many times the song is repeated. That's why I am skeptical about using this method.
Is there any better approach to shuffle the songs?
Thanks in Advance!
Aucun commentaire:
Enregistrer un commentaire