Skip to content

Commit 9bcda72

Browse files
rootroot
authored andcommitted
new file randomNumGen.js
1 parent 023cef4 commit 9bcda72

File tree

6 files changed

+6
-5
lines changed

6 files changed

+6
-5
lines changed

src/games/BrainCacl.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import theMotor from "../index.js";
2-
import { getRandomNum } from "./brainEven.js";
2+
import { getRandomNum } from "../randomNumGen.js";
33
const description = 'What is the result of the expression?';
44
const getResultOfExpression = (firstValue, operator, secondValue) => {
55
switch (operator) {

src/games/brainEven.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import theMotor from "../index.js";
22

3-
const getRandomNum = (min = 1, max = 99) => Math.floor(Math.random() * (max - min + 1) + min);
3+
import { getRandomNum } from "../randomNumGen.js";
44
const isEven = (number) => number % 2 === 0;
55

66
const description = 'Answer "yes" if the number is even, otherwise answer "no".';

src/games/brainGCD.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { getRandomNum } from "./brainEven.js";
1+
import { getRandomNum } from "../randomNumGen.js";
22
import theMotor from "../index.js";
33
const description = "Find the greatest common divisor of given numbers.";
44
const getNOD = (num1, num2)=>{

src/games/brainPGRESS.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { getRandomNum } from "./brainEven.js";
1+
import { getRandomNum } from "../randomNumGen.js";
22
import theMotor from "../index.js";
33
const genPRG = (length, firstElem, prgStep)=>{
44
const progression = [];

src/games/brainPrime.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { getRandomNum } from "./brainEven.js";
1+
import { getRandomNum } from "../randomNumGen.js";
22
import theMotor from "../index.js";
33
const isPrime = (num)=>{
44
if (num <= 1){

src/randomNumGen.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export const getRandomNum = (min = 1, max = 99) => Math.floor(Math.random() * (max - min + 1) + min);

0 commit comments

Comments
 (0)