1.2.2 • Published 5 years ago
random-operation v1.2.2
random-operation
- This helps you making you code easier to read and helping with some math
Installation
- Install this like any other npm
npm i random-operation --save
How to start
First you need to know some methods:
- operation
- calculator
- random
Let's start with the random operation:
const randomOperation = require("random-operation");
let operation = randomOperation.operation("easy"); //This returns an easy operation.
console.log(operation) //This will log an easy operation without an answer
//Easy difficulty is like 1 + 25
//Medium difficulty is like 25 * (9 + 50)
//Hard Difficulty is like (25 * 78) / (25 + 96)
/*
The difficulties are: [
"easy",
"medium",
"hard"
]
Use lowercase.
*/
- Let's see the calculator
const randomOperation = require("random-operation");
let result = randomOperation.calculator(1, "+", 1); //Use a string on the simbol
console.log(result); //This returns "2"
//The supported operations are "+", "-", "*", "/", "^"
- random method
const randomOperation = require("random-operation");
let randomResult = randomOperation.random(5, 9) //Returns a random between 5 and 9 (min, max)
console.log(randomResult);
Simple!
- I hope this helps you!