fix(web): Uniform random distribution during shuffle (#19902)

feat: better random distribution
This commit is contained in:
Pascal Sommer 2025-10-08 16:19:33 +02:00 committed by GitHub
parent 54ed78d0bf
commit 6f3cb4f1bb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 91 additions and 23 deletions

View file

@ -233,15 +233,6 @@ export class MonthGroup {
addContext.changedDayGroups.add(dayGroup);
}
getRandomDayGroup() {
const random = Math.floor(Math.random() * this.dayGroups.length);
return this.dayGroups[random];
}
getRandomAsset() {
return this.getRandomDayGroup()?.getRandomAsset()?.asset;
}
get viewId() {
const { year, month } = this.yearMonth;
return year + '-' + month;