This commit is contained in:
Kim Ravn Hansen
2025-09-19 16:04:11 +02:00
parent b1d667d7cb
commit 3a9185ca94
20 changed files with 2520 additions and 360 deletions

View File

@@ -64,6 +64,9 @@ export class Xorshift32 {
* @returns {T} One element from the array. * @return {<T>}
*/
randomElement(arr) {
if (arr instanceof Set) {
arr = [...arr];
}
const idx = this.lowerThan(arr.length);
return arr[idx];