10 lines
No EOL
308 B
TypeScript
10 lines
No EOL
308 B
TypeScript
export const getRandomInt = (min: number, max: number) => {
|
|
min = Math.ceil(min);
|
|
max = Math.floor(max);
|
|
return Math.floor(Math.random() * (max - min + 1)) + min;
|
|
};
|
|
|
|
export const clamp = (value: number, min: number, max: number) => {
|
|
return Math.min(Math.max(value, min), max);
|
|
};
|
|
|