source: node_modules/es-toolkit/dist/math/randomInt.d.mts

Last change on this file was a762898, checked in by istevanoska <ilinastevanoska@…>, 5 months ago

Added visualizations

  • Property mode set to 100644
File size: 1.1 KB
Line 
1/**
2 * Generates a random integer between 0 (inclusive) and the given maximum (exclusive).
3 *
4 * @param {number} maximum - The upper bound (exclusive).
5 * @returns {number} A random integer between 0 (inclusive) and maximum (exclusive).
6 * @throws {Error} Throws an error if `maximum` is not greater than `0`.
7 *
8 * @example
9 * const result = randomInt(5); // result will be a random integer between 0 (inclusive) and 5 (exclusive)
10 */
11declare function randomInt(maximum: number): number;
12/**
13 * Generates a random integer between minimum (inclusive) and maximum (exclusive).
14 *
15 * @param {number} minimum - The lower bound (inclusive).
16 * @param {number} maximum - The upper bound (exclusive).
17 * @returns {number} A random integer between minimum (inclusive) and maximum (exclusive).
18 * @throws {Error} Throws an error if `maximum` is not greater than `minimum`.
19 *
20 * @example
21 * const result = randomInt(0, 5); // result will be a random integer between 0 (inclusive) and 5 (exclusive)
22 * const result2 = randomInt(5, 0); // This will throw an error
23 */
24declare function randomInt(minimum: number, maximum: number): number;
25
26export { randomInt };
Note: See TracBrowser for help on using the repository browser.