Files
explorata/src/modules/common.js
2022-01-08 15:30:39 +01:00

13 lines
349 B
JavaScript

function getRandomInt(min, max) {
const minVal = Math.ceil(min);
const maxVal = Math.floor(max);
// The maximum is exclusive and the minimum is inclusive
return Math.floor(Math.random() * (maxVal - minVal) + minVal);
}
async function sleep(ms) {
await new Promise((resolve) => setTimeout(resolve, ms));
}
export { getRandomInt, sleep };