randomInt
Returns an integer random number within the specified range.
If a single argument is passed, it is treated as the maximum value, and the minimum value defaults to 0.
If two arguments are passed, the first is used as the minimum and the second as the maximum.
Code
Interface
typescript
// Function overloading
function randomInt(maximum: number): number;
function randomInt(minimum: number, maximum: number): number;
Usage
Basic Usage
typescript
import { randomInt } from '@modern-kit/utils';
const result = randomInt(10); // Returns an integer random number from 0 (inclusive) to 10 (exclusive)
With Range
typescript
import { randomInt } from '@modern-kit/utils';
const result = randomInt(5, 10); // Returns an integer random number from 5 (inclusive) to 10 (exclusive)