"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.shuffle = exports.chooseOne = exports.randomFloat = exports.randomInt = void 0;
const randomInt = (minInclusive, maxInclusive) => Math.floor(Math.random() * (maxInclusive - minInclusive + 1)) + minInclusive;
exports.randomInt = randomInt;
const randomFloat = (minInclusive, maxInclusive, decimals = 2) => {
    const value = Math.random() * (maxInclusive - minInclusive) + minInclusive;
    return Number(value.toFixed(decimals));
};
exports.randomFloat = randomFloat;
const chooseOne = (items) => {
    if (items.length === 0)
        throw new Error("Cannot choose from an empty list");
    return items[(0, exports.randomInt)(0, items.length - 1)];
};
exports.chooseOne = chooseOne;
const shuffle = (items) => {
    const copy = [...items];
    for (let i = copy.length - 1; i > 0; i--) {
        const j = Math.floor(Math.random() * (i + 1));
        [copy[i], copy[j]] = [copy[j], copy[i]];
    }
    return copy;
};
exports.shuffle = shuffle;
