mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-04-23 01:32:55 +02:00
BUGFIX: Improve implementation of getRandomInt (#1282)
This commit is contained in:
@@ -4,7 +4,7 @@ import type { NetscriptContext } from "../Netscript/APIWrapper";
|
||||
import * as allEnums from "../Enums";
|
||||
import { assertString } from "../Netscript/TypeAssertion";
|
||||
import { errorMessage } from "../Netscript/ErrorMessages";
|
||||
import { getRandomInt } from "./helpers/getRandomInt";
|
||||
import { getRandomIntInclusive } from "./helpers/getRandomIntInclusive";
|
||||
|
||||
interface GetMemberOptions {
|
||||
/** Whether to use fuzzy matching on the input (case insensitive, ignore spaces and dashes) */
|
||||
@@ -69,7 +69,7 @@ class EnumHelper<EnumObj extends object, EnumMember extends Member<EnumObj> & st
|
||||
}
|
||||
// Get a random enum member
|
||||
random() {
|
||||
const index = getRandomInt(0, this.valueArray.length - 1);
|
||||
const index = getRandomIntInclusive(0, this.valueArray.length - 1);
|
||||
return this.valueArray[index];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user