Browse Source

Fix random reordering after a song.
Random is now deterministic in its behaviour. The ordering will not
change when restarting sessions or finishing songs unless you hit the random sort button again.

Stephen Damm 5 years ago
parent
commit
b77956810d
1 changed files with 3 additions and 2 deletions
  1. 3 2
      SongBrowserPlugin/DataAccess/SongBrowserModel.cs

+ 3 - 2
SongBrowserPlugin/DataAccess/SongBrowserModel.cs

@@ -782,11 +782,12 @@ namespace SongBrowser
         /// <returns></returns>
         private List<IPreviewBeatmapLevel> SortRandom(List<IPreviewBeatmapLevel> levelIds)
         {
-            Logger.Info("Sorting song list by random (seed={0})...", this.Settings.randomSongSeed);
+            Logger.Info("Sorting song list by random (seed={0})...", Settings.randomSongSeed);
 
-            System.Random rnd = new System.Random(this.Settings.randomSongSeed);
+            System.Random rnd = new System.Random(Settings.randomSongSeed);
 
             return levelIds
+                .OrderBy(x => x.songName)
                 .OrderBy(x => rnd.Next())
                 .ToList();
         }