UNPKG

tatuka-components

Version:
14 lines 494 B
export function getRandomNumber(from, to) { if (from > to) { throw new Error('Invalid input parameters. The `from` parameter must be less than or equal to the `to` parameter.'); } var randomNumber = Math.floor(Math.random() * (to - from + 1)) + from; return randomNumber; } export function calculatePercentage(part, total) { if (total === 0) { throw new Error('Total cannot be zero'); } return (part * total) / 100; } //# sourceMappingURL=math.js.map