Make random a bit less random, but already sung songs shouldn't be suggested frequently.

This commit is contained in:
Florian Küpper committed 2013-12-19 08:50:46 +01:00
1 parent 2d4cedbf8a
commit 524d0bee75
4 files changed
+24 -2

No files matched your search

+14 -1
View File
@@ -217,7 +217,20 @@ namespace Vocaluxe.Base
public static void UpdateRandomSongList()
{
_SongsForRandom.Clear();
_SongsForRandom.AddRange(VisibleSongs);
//Calc avarage sing-count
int totalCounts = 0;
foreach (CSong song in VisibleSongs)
totalCounts += song.NumPlayedSession;
int averageCount = totalCounts / NumSongsVisible;
foreach(CSong song in VisibleSongs)
{
if (song.NumPlayedSession <= averageCount)
_SongsForRandom.Add(song);
}
if(_SongsForRandom.Count == 0)
_SongsForRandom.AddRange(VisibleSongs);
}
public static int GetRandomCategory()