This commit is contained in:
Ren Amamiya
2023-09-24 07:55:27 +07:00
parent c9bc7b81dd
commit 50f90ddcc2
12 changed files with 510 additions and 351 deletions
+6
View File
@@ -24,3 +24,9 @@ export function getRepostID(tags: NDKTag[]) {
return quoteID;
}
// get random n elements from array
export function getMultipleRandom(arr: string[], num: number) {
const shuffled = [...arr].sort(() => 0.5 - Math.random());
return shuffled.slice(0, num);
}