UNPKG

@snipsonian/core

Version:

Core/base reusable javascript code snippets

9 lines (8 loc) 385 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const assert_1 = require("../assert"); function getRandomNumber({ min = 0, max = Number.MAX_SAFE_INTEGER, } = {}) { (0, assert_1.default)(min, (val) => val >= 0, 'The min value should be minimal 0.'); return Math.floor((Math.random() * ((max - min) + 1)) + min); } exports.default = getRandomNumber;