While trying to make a Audio Player , currently working at Playlist ,and i have problem's with shuffle function .
First i have a list with file names within:
List<string> myPlaylist = new List<string>();
myPlaylist.Add("Untitled1.mp3");
myPlaylist.Add("Untitled2.mp3");
myPlaylist.Add("Untitled3.mp3");
and than with this method im getting random item at playlist :
public string shuffleme(List<string> playlist)
{
Random random = new Random();
int playlistitem = random.Next(0,playlist.Count);
return playlist[playlistitem];
}
but i need to get random element based in some kind of probability ,let say i have 1-10 values which describes a Playlist Item priority so the Item with the Lowest Priority will have a better chance to be returned against the Item with the Higher priority ,so i need to get Random item with probability based on item priority .