mirror of
https://github.com/immich-app/immich
synced 2025-11-07 17:27:20 +00:00
fix(web): Uniform random distribution during shuffle (#19902)
feat: better random distribution
This commit is contained in:
parent
54ed78d0bf
commit
6f3cb4f1bb
4 changed files with 91 additions and 23 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue