Random integer generator utility.
File: src/utils/functions/random.ts
export const randomInt = (min: number, max: number) => {
return Math.floor(Math.random() * (max - min + 1)) + min;
};
The randomInt function generates a random integer within a specified range (inclusive).
Parameters:
min: Minimum value (inclusive)max: Maximum value (inclusive)Returns: A random integer between min and max (both inclusive)
This utility is useful for generating random test data, mock values, or any scenario requiring random integer generation.
Angular Material Dev UI (or Angular Material Blocks) is one place stop for developers to explore components and blocks for their Angular Material and Tailwind CSS based applications.
Find us on X (Twitter), LinkedIn, Instagram & Threads