diff options
author | polwex <polwex@sortug.com> | 2025-06-03 15:41:31 +0700 |
---|---|---|
committer | polwex <polwex@sortug.com> | 2025-06-03 15:41:31 +0700 |
commit | 175ddca375cef765cec8ca5bbc527a205c40bf25 (patch) | |
tree | f2e47a5d85e4d5e0297613e5a17cebce7d09b09b /src/lib/utils.ts | |
parent | 2401217a4019938d1c1cc61b6e33ccb233eb6e74 (diff) |
preeeeettty much done FUCK YES
Diffstat (limited to 'src/lib/utils.ts')
-rw-r--r-- | src/lib/utils.ts | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/lib/utils.ts b/src/lib/utils.ts index 0674dea..0f0c084 100644 --- a/src/lib/utils.ts +++ b/src/lib/utils.ts @@ -63,3 +63,8 @@ export function cleanIpa(ipa: string): string { const r2 = /[\[\]\/]/g; return ipa.replace(r1, "").replace(r2, ""); } + +export function randomFromArray<T>(arr: T[]): T { + const idx = Math.floor(Math.random() * arr.length); + return arr[idx]!; +} |