sonnar 8 left. random number fixed

This commit is contained in:
Cindy Chang committed 2024-08-13 13:24:05 +08:00
1 parent 699d7a4f6b
commit 471d8273c1
4 files changed
+15 -4

No files matched your search

+7 -1
View File
@@ -12,4 +12,10 @@ export const printObject = (obj, indent = 0) => {
}
}
}
}
};
export const getRandomInt = (max) => {
const array = new Uint32Array(1);
window.crypto.getRandomValues(array);
return Math.floor(array[0] / (0xFFFFFFFF + 1) * (max + 1));
};