Procházet zdrojové kódy

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 před 5 roky
rodič
revize
b77956810d

+ 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();
         }