This commit is contained in:
Andreas Brett 2021-10-10 22:55:32 +02:00 committed by GitHub
parent 06310423f4
commit 11bcd1e2ed
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -117,7 +117,7 @@ export function getRandomInt(min: number, max: number) {
export function getCryptoRandomInt(min: number, max: number) {
const randomBuffer = new Uint32Array(1);
crypto.getRandomValues(randomBuffer);
let randomNumber = randomBuffer[0] / (0xffffffff + 1);
const randomNumber = randomBuffer[0] / (0xffffffff + 1);
min = Math.ceil(min);
max = Math.floor(max);
return Math.floor(randomNumber * (max - min + 1)) + min;