mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-12-21 05:35:45 +01:00
12 lines
378 B
TypeScript
12 lines
378 B
TypeScript
|
/**
|
||
|
* Gets a random integer bounded by the values passed in.
|
||
|
* @param min The minimum value in the range.
|
||
|
* @param max The maximum value in the range.
|
||
|
*/
|
||
|
export function getRandomInt(min: number, max: number) {
|
||
|
const lower: number = Math.min(min, max);
|
||
|
const upper: number = Math.max(min, max);
|
||
|
|
||
|
return Math.floor(Math.random() * (upper - lower + 1)) + lower;
|
||
|
}
|