mirror of
https://github.com/lukevella/rallly.git
synced 2025-04-30 02:36:30 +02:00
9 lines
294 B
TypeScript
9 lines
294 B
TypeScript
/**
|
|
* Generates a random integer between floor and max (inclusive).
|
|
* @param max The maximum value.
|
|
* @param floor The minimum value (default: 0).
|
|
* @returns A random integer.
|
|
*/
|
|
export const randInt = (max = 1, floor = 0): number => {
|
|
return Math.round(Math.random() * max) + floor;
|
|
};
|