mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-05-01 05:17:04 +02:00
MISC: Rename getRandomArbitrary (#1605)
This commit is contained in:
@@ -8,7 +8,7 @@ import { interpolate } from "./Difficulty";
|
||||
import { GameTimer } from "./GameTimer";
|
||||
import { IMinigameProps } from "./IMinigameProps";
|
||||
import { KeyHandler } from "./KeyHandler";
|
||||
import { getRandomArbitrary } from "../../utils/helpers/getRandomArbitrary";
|
||||
import { randomInRange } from "../../utils/helpers/randomInRange";
|
||||
|
||||
interface Difficulty {
|
||||
[key: string]: number;
|
||||
@@ -67,7 +67,7 @@ export function BackwardGame(props: IMinigameProps): React.ReactElement {
|
||||
}
|
||||
|
||||
function makeAnswer(difficulty: Difficulty): string {
|
||||
const length = getRandomArbitrary(difficulty.min, difficulty.max);
|
||||
const length = randomInRange(difficulty.min, difficulty.max);
|
||||
let answer = "";
|
||||
for (let i = 0; i < length; i++) {
|
||||
if (i > 0) answer += " ";
|
||||
|
||||
@@ -8,7 +8,7 @@ import { interpolate } from "./Difficulty";
|
||||
import { GameTimer } from "./GameTimer";
|
||||
import { IMinigameProps } from "./IMinigameProps";
|
||||
import { KeyHandler } from "./KeyHandler";
|
||||
import { getRandomArbitrary } from "../../utils/helpers/getRandomArbitrary";
|
||||
import { randomInRange } from "../../utils/helpers/randomInRange";
|
||||
|
||||
interface Difficulty {
|
||||
[key: string]: number;
|
||||
@@ -35,7 +35,7 @@ function generateLeftSide(difficulty: Difficulty): string {
|
||||
if (Player.hasAugmentation(AugmentationName.WisdomOfAthena, true)) {
|
||||
options.splice(0, 1);
|
||||
}
|
||||
const length = getRandomArbitrary(difficulty.min, difficulty.max);
|
||||
const length = randomInRange(difficulty.min, difficulty.max);
|
||||
for (let i = 0; i < length; i++) {
|
||||
str += options[Math.floor(Math.random() * options.length)];
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ import { interpolate } from "./Difficulty";
|
||||
import { GameTimer } from "./GameTimer";
|
||||
import { IMinigameProps } from "./IMinigameProps";
|
||||
import { KeyHandler } from "./KeyHandler";
|
||||
import { getRandomArbitrary } from "../../utils/helpers/getRandomArbitrary";
|
||||
import { randomInRange } from "../../utils/helpers/randomInRange";
|
||||
|
||||
interface Difficulty {
|
||||
[key: string]: number;
|
||||
@@ -78,7 +78,7 @@ export function CheatCodeGame(props: IMinigameProps): React.ReactElement {
|
||||
function generateCode(difficulty: Difficulty): Arrow[] {
|
||||
const arrows: Arrow[] = [leftArrowSymbol, rightArrowSymbol, upArrowSymbol, downArrowSymbol];
|
||||
const code: Arrow[] = [];
|
||||
for (let i = 0; i < getRandomArbitrary(difficulty.min, difficulty.max); i++) {
|
||||
for (let i = 0; i < randomInRange(difficulty.min, difficulty.max); i++) {
|
||||
let arrow = arrows[Math.floor(4 * Math.random())];
|
||||
while (arrow === code[code.length - 1]) arrow = arrows[Math.floor(4 * Math.random())];
|
||||
code.push(arrow);
|
||||
|
||||
@@ -9,7 +9,7 @@ import { GameTimer } from "./GameTimer";
|
||||
import { IMinigameProps } from "./IMinigameProps";
|
||||
import { KeyHandler } from "./KeyHandler";
|
||||
import { isPositiveInteger } from "../../types";
|
||||
import { getRandomArbitrary } from "../../utils/helpers/getRandomArbitrary";
|
||||
import { randomInRange } from "../../utils/helpers/randomInRange";
|
||||
|
||||
interface Difficulty {
|
||||
[key: string]: number;
|
||||
@@ -200,7 +200,7 @@ function generateQuestion(wires: Wire[], difficulty: Difficulty): Question[] {
|
||||
|
||||
function generateWires(difficulty: Difficulty): Wire[] {
|
||||
const wires = [];
|
||||
const numWires = getRandomArbitrary(difficulty.wiresmin, difficulty.wiresmax);
|
||||
const numWires = randomInRange(difficulty.wiresmin, difficulty.wiresmax);
|
||||
for (let i = 0; i < numWires; i++) {
|
||||
const wireColors = [colors[Math.floor(Math.random() * colors.length)]];
|
||||
if (Math.random() < 0.15) {
|
||||
|
||||
Reference in New Issue
Block a user