Keyed random seed

This commit is contained in:
Jack Hamilton
2024-10-11 02:37:11 -05:00
parent 0ab795bfa3
commit 3d087f4428
3 changed files with 9 additions and 1 deletions

View File

@ -72,6 +72,8 @@ import tachiyomi.domain.track.model.Track
import tachiyomi.source.local.isLocal
import uy.kohesive.injekt.Injekt
import uy.kohesive.injekt.api.get
import java.util.Collections
import kotlin.random.Random
/**
* Typealias for the library manga, using the category as keys, and list of manga as values.
@ -305,7 +307,7 @@ class LibraryScreenModel(
return mapValues { (key, value) ->
when (key.sort.type) {
LibrarySort.Type.Random -> value.shuffled()
LibrarySort.Type.Random -> value.shuffled(Random(libraryPreferences.currentRandomSortSeed().get()))
else -> {
val comparator = key.sort.comparator()
.let { if (key.sort.isAscending) it else it.reversed() }