mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-06 02:00:46 +00:00
12 lines
285 B
TypeScript
12 lines
285 B
TypeScript
|
|
/**
|
|
* Generate a random integer in range.
|
|
* @param min minimum inclusive
|
|
* @param max maximum exclusive
|
|
*/
|
|
export function GetRandomInt(min: number, max: number) : number {
|
|
min = Math.ceil(min);
|
|
max = Math.floor(max);
|
|
return Math.floor(Math.random() * (max - min)) + min;
|
|
}
|