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
4 changed files with 91 additions and 23 deletions

View File

@@ -82,11 +82,6 @@ export class DayGroup {
return this.viewerAssets[0]?.asset;
}
getRandomAsset() {
const random = Math.floor(Math.random() * this.viewerAssets.length);
return this.viewerAssets[random];
}
*assetsIterator(options: { startAsset?: TimelineAsset; direction?: Direction } = {}) {
const isEarlier = (options?.direction ?? 'earlier') === 'earlier';
let assetIndex = options?.startAsset