mirror of
https://github.com/louislam/uptime-kuma.git
synced 2024-10-30 11:10:40 +00:00
const
This commit is contained in:
parent
06310423f4
commit
11bcd1e2ed
1 changed files with 1 additions and 1 deletions
|
@ -117,7 +117,7 @@ export function getRandomInt(min: number, max: number) {
|
||||||
export function getCryptoRandomInt(min: number, max: number) {
|
export function getCryptoRandomInt(min: number, max: number) {
|
||||||
const randomBuffer = new Uint32Array(1);
|
const randomBuffer = new Uint32Array(1);
|
||||||
crypto.getRandomValues(randomBuffer);
|
crypto.getRandomValues(randomBuffer);
|
||||||
let randomNumber = randomBuffer[0] / (0xffffffff + 1);
|
const randomNumber = randomBuffer[0] / (0xffffffff + 1);
|
||||||
min = Math.ceil(min);
|
min = Math.ceil(min);
|
||||||
max = Math.floor(max);
|
max = Math.floor(max);
|
||||||
return Math.floor(randomNumber * (max - min + 1)) + min;
|
return Math.floor(randomNumber * (max - min + 1)) + min;
|
||||||
|
|
Loading…
Reference in a new issue